Hello All,
We recently migrated from CRM 2011 to CRM 2013, in CRM 2011 onload events get triggered after save event but the same is not happening in CRM 2013.
*This post is locked for comments
None of the solution helped from above link.
Regards,
Rahul
Hi All,
I have added below function onchange of Modified On field, using below line of code form is getting refreshed,
function RefreshedAfterSave(){
Xrm.Utility.openEntityForm("incident", Xrm.Page.data.entity.getId());
}
Now, when this function is getting executed I am getting message from webpage.
---------------------------
Message from webpage
---------------------------
Your changes have not been saved. To stay on the page so that you can save your changes, click Cancel.
---------------------------
OK Cancel
---------------------------
How to prevent this error message.
Regards,
Rahul
HI ,
I agree with Santosh , that might be the cause of problem .
Rahul ,
Please try to add another refresh in javascript based on form type (Update),
Hope it might help
Thanks
Hi
Actually, for New Save only Form will save and refresh the Page. For Existing records, if you save the record then Only OnSave Operation will trigger.
In this scenario OnLoad event will not trigger
I have Current Status option-set on form, there are say 10 values present.
While loading the form I am checking if the formtype is create then remove all other values and keep only one value as "Assigned". Now once the record is saved I need to show one more option in that as "In Progress" in this case I need to call load event after save or need to refresh the form so that the control goes to the respective function and shows that other value and hide remaining.
I have added that function on change of modifiedon field which will get changed everytime you save the record.
While debugging I can see debugger is going inside the function but the changes are not getting reflected on form.
Hi Rahul,
On load event will not be triggered after Save.
What exactly you are trying to do after save?
Thanks
Hemant Sahu
Got the issue. It will trigger OnLoad and Onload again you are refreshing the page. So it will call infinite times.
I am saying that
function OnAfterSave(){
// Change Status
}
This function should call on Modified On
or else
function OnSave(){
// Change Status
}
function OnLoad(){
Var formType=Xrm.Page.ui.getFormType()
if (formType==2) // Existing Load
{
// Change Status
}
}
Call OnLoad and On Save function Load and Save respectively. Don't refresh the page forcefully.
I tried all possible options like
1. OnSave(context)
{
//my logic
...
...
Xrm.Page.data.save.then(SuccessOnSave, ErrorOnSave);
}
function SuccessOnSave()
{
//force refresh
Xrm.Page.data.refresh();
}
function ErrorOnSave()
{
//do nothing
}
2. Calling OnLoad in OnSave event.
But in both case its going in infinite loop. I tried the specific function with SetTimeOut method too but that too getting call n number of times.
Is there any way to check postoperation of event in JS.
If we did this then it should work. Okay one thing is there any workflow will run based on this Status?
If not, you can call this function OnSave and OnExisting Load also
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,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156