Hi All,
I have an embedded canvas app placed on the CRM Form.
I am using an Edit Form within the canvas app to display data of the form and have Save button on the form to update the values entered in the canvas app.
Formula applied -
onselect property of the Save button -
SubmitForm(Form)
onSuccess property of the button -
Notify("Record saved sucessfully",NotificationType.Success)
Issue :
The notify message appears even when nothing is changed on the form and Save button is clicked.
Solved! Go to Solution.
Hi @Poweruser1101 ,
If the Unsaved property does not work properly, you could try another method.
I did a simple test for you. (I embedded a canvas in the model driven)
1\ This is my form . There are two fields in the form that can be modified.( Maybe your form has more fields that can be modified)
2\ Set the onselect property of the submit Icon control to:
Set(Thevar1,Concatenate(ModelDrivenFormIntegration.Item.Id,ModelDrivenFormIntegration.Item.Name));Set(Thevar2,Concatenate(DataCardValue1.Text,DataCardValue2.Text));If(Thevar1<>Thevar2,SubmitForm(Form1))
// ModelDrivenFormIntegration.Item is the Item property of my form control. (Maybe your Item property is another value, such as : Gallery. selected)
DataCardValue1 is the control of Id card.
DataCardValue2 is the control of Name card.
3\ Set the OnSuccess property of the Edit form control to:
Notify("Record saved sucessfully",NotificationType.Success)
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
This is supposed to happen. Even though no data has changed the form has still submitted and triggered the OnSuccess code.
Maybe you could add the current selected form item to a variable. For example in the gallery that navigates to a form Set(varRecord, ThisItem).
You could then use LastSubmit in OnSuccess to get the updated record. Set(varSubmitted, Form.LastSubmit). Then it would be a case of comparing the contents of both variables to determine if there has been a change.
You could then use this as a condition for whether the banner displays.
@Digital Hey thank you for your reply.
Since i am using embedded canvas app, i can set the varRecord in the onvisible property of the screen
Set(varRecord, ModelDrivenFormIntegration.Item)
and can also set the OnSuccess property with Set(varSubmitted, Form.LastSubmit)
But where and how do i compare these values
because the notify message is on "onsuccess" property of the form.
Kindly advice
Hi @Poweruser1101 ,
I suggest you use the Unsaved property of the Edit form control.
When the user modifies the data in the form, the value of this property is true.
At this time, the user is allowed to submit the form and use the Notify() function on the OnSuccess property.
When the user does not modify the data, the value of this property is false.
At this time, users are not allowed to use the SubmitForm() function, and the OnSuccess property will not be triggered.
You could try the following steps:
1\ Set the OnSelect property of the submit button control to:
If(Form1.Unsaved= true, SubmitForm(Form1))
2\ Set the OnSuccess property of the Edit form control to:
Notify("Record saved sucessfully",NotificationType.Success)
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
@v-xiaochen-msft Hey For me the Form.Unsaved property is always true. I tried displaying in a label.
Not sure why? is it one of my field is getting dirty on load? is there a way i can field which field?
Also can i modify Form.unsaved within canvas apps like setting the value to false once the form is submitted?
Hi @Poweruser1101 ,
If the Unsaved property does not work properly, you could try another method.
I did a simple test for you. (I embedded a canvas in the model driven)
1\ This is my form . There are two fields in the form that can be modified.( Maybe your form has more fields that can be modified)
2\ Set the onselect property of the submit Icon control to:
Set(Thevar1,Concatenate(ModelDrivenFormIntegration.Item.Id,ModelDrivenFormIntegration.Item.Name));Set(Thevar2,Concatenate(DataCardValue1.Text,DataCardValue2.Text));If(Thevar1<>Thevar2,SubmitForm(Form1))
// ModelDrivenFormIntegration.Item is the Item property of my form control. (Maybe your Item property is another value, such as : Gallery. selected)
DataCardValue1 is the control of Id card.
DataCardValue2 is the control of Name card.
3\ Set the OnSuccess property of the Edit form control to:
Notify("Record saved sucessfully",NotificationType.Success)
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
User | Count |
---|---|
255 | |
114 | |
95 | |
48 | |
38 |