Hi All,
I created a error message with javascript. It's not showing when I click the save and close button. How I fix this problem?
Thanks.
Hi All,
I created a error message with javascript. It's not showing when I click the save and close button. How I fix this problem?
Thanks.
Can you share your requirement ?because if you want to show the error and also need previous values of lookup then custom actions will be the best choice, As we can not get previous values of lookup in JS.
Thank you,
Amit Katariya
Hi,
In javascript it is not possible to get old values.
Just in case we want to get old values then we have to go to plugins.
Because plugins have a way names as Plugin images Pre and Post images.
Hi All,
I can see my dialog box error even I click saveandclose thank you.
I have another queston; I want to get the previous value of the lookup field that I changed for the cancel button of the dialog box.
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = preSubStatus._msdyn_substatus_value;
lookupValue[0].name = preSubStatus["_msdyn_substatus_value@OData.Community.Display.V1.FormattedValue"]; // Name of the lookup
lookupValue[0].entityType = preSubStatus["_msdyn_substatus_value@Microsoft.Dynamics.CRM.lookuplogicalname"]; //Entity Type of the lookup entity
// set the booking status to previous value
formContext.getAttribute("msdyn_substatus").setValue(lookupValue);
I did like that but it still it gives the value i changed.
Hi,
Please share your entire code
Do you have parameter with same name as executionContext for your function?
Have you selected check to pass execution contrxt as first parameter
I added "executionContext.getEventArgs().getSaveMode(); " but when I debug, it says it's undefined
Hi,
You need to use getSaveMode api to know which save button is clicked
Hi,
Please share your code...
Hi,
Please check below links:
https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/save-event-arguments/preventdefault
https://softchief.com/2022/06/10/restrict-cancel-save-operation-conditionally-in-javascript-as-per-async-operations-result-in-dynamics-365/
Thank You,
Pradeep Rai.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156