cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Solution Sage
Solution Sage

Use SetNotification to show error messages?

Is it possible to access SetNotification within a field control to display an error message if required (say in a bound control when the number is out of range)? This would ensure the error message would be displayed at the top of the form were someone to try and save the record while the error existed.

 

Now logged as an idea at https://powerusers.microsoft.com/t5/PowerApps-Ideas/Allow-a-PCF-field-component-to-flag-a-field-as-i...

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: Use SetNotification to show error messages?

hi Ben,

 

Thanks for your nice explaination and providing the real situation that a control with regular expression input should bundle together. This is a very valuable feedback!

 

To realize the scenario, I think your ask is:

1) Officially expose setNotification from control side

2) Whenever setNotificatin is being called, block form save

 

We value your feedback, please confirm if this is the ask

 

Thanks,

Anqi

 

 

View solution in original post

11 REPLIES 11
Highlighted
Power Apps
Power Apps

Re: Use SetNotification to show error messages?

hi Ben,

 

Here is what my understanding, hopefully it helps,

 

1. If the field is a number field with a static range, then if the output it out of the range, it will show error message and blocks the form save.

 

2. Could a field custom control access SetNotification?

Yes, it could, but we did not expose this API. It should be ‘context.utils.setNotification’

 

3. Could a field customcontrol call setNotification and block the form save together?

We currently did not block form save when setNotification is from a control.

But when clientAPI setNotification, it will block form save.

 

4. If a field violates dynamic range, a notification should show and form should block save, is there any work-around on achieving this?

 

Yes, whenever user output data, it triggers clientAPI, and clientAPI triggers setNotification

 

User’s custom control could have 3 properties and could bound to 3 attributes in the form

 

<property name=’value’   bound to the current field

<property name=’max’ bound to a hidden ‘dynamic max’ field

<property name=’min’ bound to a hidden ‘dynamic min’ field

 

The  ‘current field value’ clientAPI onChange handler will need to check its value is in dynamic range and set/clear notification accordingly.

 

Feel free to ask follow-up question or IM me if details is needed

 

Anqi

Highlighted
New Member

Re: Use SetNotification to show error messages?

 
Highlighted
Solution Sage
Solution Sage

Re: Use SetNotification to show error messages?

Anqi, thanks for that it answers my question but also doesn't answer it.

 

Both @ashlega  (with his regular expression question elsewhere) and myself seem to be looking at creating controls where the logic to ensure the value entered is valid is fully contained within the control itself. 

 

By storing the validation logic within the control rather than within the client api it would be possible to move validation from a code (javascript) or low code (business rules) to a zero code solution where all a user is required to do would be to create the field, add it to a form and change the control type (say) from a standard textfield to a range limited or regular expression textfield, add the validation critiera and the field will be ready to go. 

 

I will add an appropriate post in the ideas section.

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".
Highlighted
Power Apps
Power Apps

Re: Use SetNotification to show error messages?

hi Ben,

 

Thanks for your nice explaination and providing the real situation that a control with regular expression input should bundle together. This is a very valuable feedback!

 

To realize the scenario, I think your ask is:

1) Officially expose setNotification from control side

2) Whenever setNotificatin is being called, block form save

 

We value your feedback, please confirm if this is the ask

 

Thanks,

Anqi

 

 

View solution in original post

Highlighted
Solution Sage
Solution Sage

Re: Use SetNotification to show error messages?

Yes that would be my ask:-

expose setNotification on the control side

ensure that setNotification works as it does on the Client API side and stops the page from saving until the notification is cleared.

 

Thanks.

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".
Highlighted
Power Apps
Power Apps

Re: Use SetNotification to show error messages?

Highlighted
Solution Sage
Solution Sage

Re: Use SetNotification to show error messages?

Hermant,

 

I know I was the person to post it.

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".
Highlighted
Power Apps
Power Apps

Re: Use SetNotification to show error messages?


@ben-thompson wrote:

Hermant,

 

I know I was the person to post it.


Ha ha I know, this is for everyone else. You need votes too 🙂

Advocate I
Advocate I

Re: Use SetNotification to show error messages?

Thanks @AnqiChen this reply is helpful. Asking a couple of further relevant questions please:

 


@AnqiChen wrote:

 

2. Could a field custom control access SetNotification?

Yes, it could, but we did not expose this API. It should be ‘context.utils.setNotification’

Are you saying you this API is not documented for public use but available or it is something new and will be released in future?

 


Yes, whenever user output data, it triggers clientAPI, and clientAPI triggers setNotification

 

User’s custom control could have 3 properties and could bound to 3 attributes in the form

 

<property name=’value’   bound to the current field

<property name=’max’ bound to a hidden ‘dynamic max’ field

<property name=’min’ bound to a hidden ‘dynamic min’ field

 

The  ‘current field value’ clientAPI onChange handler will need to check its value is in dynamic range and set/clear notification accordingly

 

Instead of JS on change of current field value, as per current infrastructure can it form level? On form load hocking onSave, check data- and if found don't save? 

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (6,569)