Showing results for 
Search instead for 
Did you mean: 

Allow a PCF field component to flag a field as invalid and stop page save.

Based on Use SetNotification to show error messages?  could I suggest that you make it possible for a powerapp component framework field component to flag it's value as invalid and stop the page from saving until the error is corrected 


I understand that this is currently possible using the clientapi but that requires additional work and a code (Javascript) or low code (Business rules) solution where this method would allow a zero code solution where the only thing required would be to add the field to the form, change the field type to the component and add the appropriate validation within the controls parameters / configuration.

Status: Under Review
Memorable Member

I forgot another reason for things being handled here.


By moving error handling within the component the out of the box language pack functionality can be used for translating error messages - something that is rarely implemented within Javascript scripts.

Advocate IV

I support the idea. This will also open up the opporutnity to develop validator controls (like validator controls).


Ideally, we want

  1. A function implementation where we define validation logic and return a boolean value, and
  2. A property to set a custom error message

The implementation could be quite similar to Dynamics Portal client-side validation.


I understand this could be a fundamental change to the existing form validation and could be oustide of PCF development.

Power Apps
Status changed to: Under Review
Frequent Visitor


If the approach that I have used is a supported one, then for the setNotification/clearNotification functionality under PCF control, we can get the function for "setNotification" or "clearNotification" from "GetFunctionFromContextUtils" function (specified below) and process it.

By using the below approach, I have designed a PCF based Apply Regex Validation Custom Control which basically set/clear field notification.


public processForRegex(sValueToProcess: string): void
		var sNotification = this.isValid(this.sNotificationToUser) ?
			this.sNotificationToUser : this.sDefaultErrorLabel;
		var sUniqueId = sNotification + "_UniqueId";

		var objClearNotification = null;
		var objSetNotification = null;
		objClearNotification = this.GetFunctionFromContextUtils("clearNotification");
		objSetNotification = this.GetFunctionFromContextUtils("setNotification");		
		if(this.isValid(objClearNotification) && this.isValid(objSetNotification))
			objClearNotification = objClearNotification as Function;
			objSetNotification = objSetNotification as Function;
			if(//logic for setNotification)
				objSetNotification(sNotification, sUniqueId);
			else //logic for clearNotification
public GetFunctionFromContextUtils(sFunctionName: string): Function | null
		var objFunctionToReturn = null;
		if(this.isValid(this.objContext) && this.isValid(this.objContext.utils) &&
		   this.isValid((this.objContext.utils as any)[sFunctionName]))
			objFunctionToReturn = (this.objContext.utils as any)[sFunctionName] as Function;
		return objFunctionToReturn;


Advocate II

Any progress here, @HemantG ? In the meantime I've to add client-side script wherever the control is used to prevent save and ensure validation. Thanks!

Regular Visitor

Something as simple as the getOutputs() function but for validation messages would be perfect IMO.