CRM 2013 - OnChange Event firing always RRS feed

  • Question

  • Hello everyone,

    I am really stuck with this issue and almost in panic mode as if the sky is falling, i have exhausted all the options that my brain can think, wanting help of you all to save me from this issue.

    We are in the process of upgrading our solution from CRM 2011 to CRM 2013, everything was going smooth but lately we noticed performance hiccups and upon going deep down in code, we figured a major flaw.

    So here is the scenario:

    • I have a common function let's say SetData('someparameter') set to onChange event of 5 fields (Field 1, Field 2... Field 5) on the Form. I am passing unique parameters from OnChange and in the function code i have IF blocks that work according to each block.
    • Within each block for let's say block for 'Field 1' in function, i am setting data for 'Field 2' and calling Xrm.Page.data.entity.save() in JavaScript which triggers my plugin for some processing.

    Problem is:

    • Every time data is set in field2 in JavaScript, it is firing 'SetData' function which is actually on the Form Level. Which causes 'SetData' to re-trigger. I am really confused what is causing the execution for function that is set on Form Level. (I have reviewed the current flow in CRM 2011) and it works fine. (when i set data in code, the form level onChange trigger never fires).

    Is that a known issue with CRM 2013, or is there anything i am missing, what are the possible options?
    My head is blowing, will take few hours break... looking forward for some input, 

    Kind Regards,

    Please VOTE AS HELPFUL if applicable.

    Friday, September 12, 2014 5:57 AM

All replies

  • Hi,

    In MSCRM 2013, when you save record or call save method it will fire on-change event handler of the fields. But this is not the case in MS CRM 2011. So check your code if your event handler is called because of save.

    Hope it will help !!

    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Friday, September 12, 2014 7:39 AM
  • Thanks Mahender for quick reply.

    I have almost 15 fields with onChange code on all of them. I have put alerts in all of those trigger functions to cross-check what you mentioned but none of them are getting executed onSave. It is only firing for 2 fields. There is a missing link here.

    Also, i have read OnOpen will only execute once, after you save it it will never execute, that is not true in my case because with each Xrm.Page.data.entity.save() call the OnOpen function is getting fired always.

    Honestly, it's all messed up...

    Please VOTE AS HELPFUL if applicable.

    Friday, September 12, 2014 9:13 AM