Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

on which field plugin is getting fired.

Posted on by

Hello All,

I have a plugin which runs on pre-operation and on update of the entity.

in the filtering attribute there are 4 fields.

i am not able to understand on which field it's getting run.

can anyone help me in this.

i am confused in this.

*This post is locked for comments

  • Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: on which field plugin is getting fired.

    Hi Andrii,

    Sure. points taken.

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: on which field plugin is getting fired.

    Alagunellaikumar 

    your code has 4 errors:

    Entity objCustomEntity=(ENtity) context.InputParameter["target"];

    f(objCustomEntity.Attributes.contains("name"))

    bIsNameFieldChange=true;

    1. There is no ENtity class. There is Entity.

    2. There is InputParameter property. There is InputParameters.

    3. There is no target key for InputParameters collection. There is Target.

    4. There is no contains method. There is Contains.

    I understand that you wrote this code many times (because I did that as well) but let me suggest you a small thing (only with best wishes) - recheck your syntax twice before posting reply to a forum and marking it as a reply.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: on which field plugin is getting fired.

    Hi,

    You can use "(context.InputParameters["Target"]).Attributes" statement for getting the details of the field which hasbeen changed along with "guid","modifiedon","modifiedby","modifiedonbehalfby" fields.

    Warm regards;

    Ranjith Kunnath

    If found useful, please mark the answer as verified.

  • AbhiCode Profile Picture
    AbhiCode 492 on at
    RE: on which field plugin is getting fired.

    Hi,

    Check the audit history, which field is modified. Or you need to debug the plugin.

    Or you can add Logging and tracing (ITracingService) so easy find which field is modified

    Thanks

  • Suggested answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: on which field plugin is getting fired.

    Hi,

    In the plugin use below code

    Entity objCustomEntity=(ENtity) context.InputParameter["target"];

    var bIsNameFieldChange=false;

    var bIsAddressFieldChange=false;

    if(objCustomEntity.Attributes.contains("name"))

    bIsNameFieldChange=true;

    if(objCustomEntity.Attributes.contains("Line1"))

    bIsAddressFieldChange=true;

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: on which field plugin is getting fired.

    Checking field under input property bag collection will be the best option in this case instead of doing it from plugin image.

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: on which field plugin is getting fired.

    Hi,

    You can register the following images in the update step.

    1. Pre-image is the image of the record before the update action has been performed.

    2. Post Image returns the image of the record after the update action has been performed.

    The context "Target" contains only the updated fields of the record.

    sumedha8.blogspot.in/.../sample-plug-in-compare-pre-and-post.html

    msdn.microsoft.com/.../gg309673.aspx

    community.dynamics.com/.../utilising-pre-post-entity-images-in-a-dynamics-crm-plugin

    crmbook.powerobjects.com/.../plug-in-images-pre-vs-post

  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: on which field plugin is getting fired.

    Hi EmployeeOcta,

    You can use the PreImage to compare with what's in the context to find out which fields have changed.  Below article explains this clearly.

    www.toplinestrategies.com/.../dynamics-crm-plugins-how-determine-updated-fields

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: on which field plugin is getting fired.

    Hello,

    I believe you can find that information directly in plugin. Target from context's InputParameters is Entity that will contain only fields that were changed.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans