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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Update Plugin is being called even if Filtering Attribute field is not changed.

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I am facing an unusual issue here with Plugins. I have registered a Plugin on Update of entity in Post Operation stage and have included just one field (checkBox field/ 2 option set field on the Form) in the Filtering Attribute of that step. Now when I am trying to open an existing record and changing other fields on the Form, its giving me an error in the same Plugin. When I tried putting in Traces to debug this issue I am getting the below:

tracingService.Trace("Contains: " + entity.Attributes.Contains("amd_eventwithoutmarketinglist"));  ------> True    [Not even touched this field]

I am wondering why is it giving true even if I did not touch this field. Generally entity.Attributes contains a value only when the field is changed. My main doubt here is that why this Pugin is even called when the field on which it is expected to trigger is not changing and other fields on the same form are changing. Please let me know if you have any idea about this.

Regards

Tushar

*This post is locked for comments

I have the same question (0)
  • FabioG Profile Picture
    130 on at

    did you see if there is any business rule / workflow / javascript that works on it?

  • Verified answer
    Radu Chiribelea Profile Picture
    6,667 on at

    on top of FaboiG question - check if you have any setSubmitMode("always") called against this field. If the submitmode is set to always, then even if the field value isn't changed then it will still be submitted to the crm database

  • Community Member Profile Picture
    on at

    Hi FabioG,

    There is one JS function which is called onChange of 'Events without Marketing List' CheckBox field. There is also one business rule which makes the other field on the same form writable and read-write on check and uncheck of CheckBox respectively.I am just changing the name of the Event on the form and nothing else. So as per my understanding no JS or business rule is called. There is one other JS onChange of Name but I saw the code, that JS is not changng the value of any other field or not triggering the Plugin in any way.

    Are there other ways this can be happening?

  • Community Member Profile Picture
    on at

    I am the one who put the field on the Form. i have not used setSubmitMode for this field.

  • Community Member Profile Picture
    on at

    The Plugin is giving error on execution of this line - entity.Attributes["amd_eventwithoutmarketinglist"].ToString().ToLower()!

    On one hand entity.Attributes.Contains("amd_eventwithoutmarketinglist")) is coming true while on the other hand the above mentioned line is giving error. The error which I am getting i "Object reference not set to an instance of an object". Please let me know if you need any furthur information on the issue I am getting.

  • Community Member Profile Picture
    on at

    Radu, actually one of my other teammates updated the code and included this field in setSubmitMode("always"). I removed my field and it is working nicely now. Thanks for your suggestion.

  • Suggested answer
    FabioG Profile Picture
    130 on at

    for the error about entity.Attributes["amd_eventwithoutmarketinglist"].ToString().ToLower() I will put a control on the attribute before the conversion for example:

    if (entity.Attributes["amd_eventwithoutmarketinglist"] != null || entity.Attributes["amd_eventwithoutmarketinglist"] != entity.Attributes["amd_eventwithoutmarketinglist"] != null)

    {

    entity.Attributes["amd_eventwithoutmarketinglist"].ToString().ToLower()

    }

    with this instruction you can do a conversion if the attribute is not null.

    eventually you can put a breakpoint and catch the execution with a profiler (in case of 365 version) and attach on the process to see what kind of data is retrieving. Usually i use this technique for my develop to achieve my plugin/workflow/action.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans