Display Error and Success Notification in Power apps

Loading

Requirement: Display a NotificationType Success or Error in application(Power app)

Create a Blank Canvas app Insert a labels, ComboBox ,TextInput and Button

  • Label1Title
  • Combobox1[“”,”Mr”,”Ms”,”Mrs”]
  • Label2 Contact Info
  • TextInput1add details

On Submit Button write the below formula for declaring the notification type according to the fields filled.

//Title error
UpdateContext({varTitleError: If(IsBlank(ComboBox1.Selected),"This field is Required", false)});

//Contact info error
UpdateContext({varContactInfoError: If(IsBlank(TextInput1_1), "This field is Required", false)});

//Submit button
If(IsBlank(ComboBox1.Selected.Value) || (TextInput1_1.Text), Notify("Their is an Error in submitting", NotificationType.Error,4000),Notify("Details Submitted Successfully",NotificationType.Success,4000));

On Label to the combobox and Textinput to make it invisbile before and after entering and submitting the details

Visible property-If(IsBlank(ComboBox1.Selected),true, false)

Visible property-If(IsBlank(TextInput1_1.Text), true, false)

When the user click on submit button without filling the details it displays an error message as “Their is an error in Submitting”.

When the user click on submit button After filling the details it displays an success message as “Details submitted successfully”.

Leave a Reply

Your email address will not be published. Required fields are marked *