web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

OnChange Event fire automatically after save Case form

(0) ShareShare
ReportReport
Posted on by 115

I am getting a strange problem whenever case form is saved On Change event fired automatically.

Suppose if I am creating a new case and populating a field on form and if on change event is registered for that field then it will be called at the time when I populate this field. This is ok but when I save the form then again on change event is fired. If I change five fields on the form and they all have the on change events registered then after save all five on change event will be fired. 

Same is happening on update, on change event fired automatically after change.

I am getting this problem after CRM Online update 1. This was working fine on prior crm versions.

Please help on this. 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    Can you try switching to the "Use legacy form rendering" as yes by going to Settings-->Administration-->System Settings. The options is available at the bottom of General tab. After the update 1 many users have faced javascript related issues.

  • AnkitSingh Profile Picture
    115 on at

    Thanks for reply. I have already done this setting on production but "Use legacy form rendering"  will be removed on the next update so I am looking for the solution that will work on next update.

  • AnkitSingh Profile Picture
    115 on at

    Can somebody help to get rid from this?

  • Sukh Gill Profile Picture
    967 on at

    Hi Ankit

    Did you ever solve this issue as we experience the same problem where if a field is changed programmatically (via JavaScript), when the form is saved any fields that have been changed will fire the onChange handlers associated to the field.  This should not be expected behaviour and is stopping us from using Turbo forms.  This behaviour does not occur with legacy form rendering.

    Thanks
    Sukh

  • Sukh Gill Profile Picture
    967 on at

    I see others have experienced this same issue.

    community.dynamics.com/.../165954

  • Suggested answer
    Maarten Hamburg Profile Picture
    on at

    We had a simulair issue. We had a setValue to set the value of a lookup field.

    Xrm.Page.getAttribute("myfield1").setValue([{id: Val.Id, name: Val.Name,entityType: Val.LogicalName}]);

    Due to the invalid id the framework executes a second onchange. We changed the value:

    Xrm.Page.getAttribute("myfield1").setValue([{id: '{'+Val.Id.toUpperCase()+'} , name: Val.Name,entityType: Val.LogicalName}]);


    and now it is working for us. Hope this will help you

  • Suggested answer
    Alexey Shytikov Profile Picture
    20 on at

    I can confirm, this the answer by Maarten Hamburg actually works. It indeed solves the problem, despite might look ridicules.

    According to MS some internals was changed, so if GUID was supplied not in fully correct format, CRM now tries to double check it, thus running onChange validation for this field once again.

    This is insanely stupid, because this validation does even worse... Anyway... According to official documentation setValue should now accept only {UPPER-CASE-GUIDS-WITH-BRACES}.

    via: msdn.microsoft.com/.../gg334409%28v=crm.8%29.aspx

  • Alexey Shytikov Profile Picture
    20 on at

    I have created issue on Connect, you can follow discussion: connect.microsoft.com/.../2527691

  • Verified answer
    AnkitSingh Profile Picture
    115 on at

    The issue with Guid that we are setting in lookups.

    We have used this function to set Lookup values:

    function SetLookupValue(LookupId, Type, Id, Name) {
        if (Id.indexOf('{') == -1)
            Id = '{' + Id;
        if (Id.indexOf('}') == -1)
    Id = Id + '}'; Id = Id.toUpperCase(); var lookupReference = []; lookupReference[0] = {}; lookupReference[0].id = Id;
    lookupReference[0].entityType = Type; lookupReference[0].name = Name; Xrm.Page.getAttribute(LookupId).setValue(lookupReference); }

    This will work.

    Gud Luck

  • Community Member Profile Picture
    on at

    Hi,

    what is the solution with a field not lookup?.

    Best regads

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans