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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Attributes available on update

(0) ShareShare
ReportReport
Posted on by 407


Scenario - lets say you develop a plugin for contact entity for update message, there are 10 attributes on the form and you update the last name and if you register in Pre-event
lIn which property are the entity details available? and what fields are available? how to update a attribute that is not in the form?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Aniket,

    The Target entity will always contain the values being modified in the current pipeline - irrespective of stage. So you can access the modified values in the Pre-Operation.

    You can add additional values to the Target entity using the following:

    entity.Attributes.Add(attributeName, attributeValue);

    Hope this helps.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    Entity entity=(Entity)context.InputParameters["Target"];

    entity.Attributes.Add("new_salesid", "123"); <-- one of the sample code

    stackoverflow.com/.../plugin-pre-operation-create-update-field-error

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Aniket,

    If you update a field says "field A" on a record and have a plugin registered on Pre/Update then-

    1. You will get the the attribute value under the target property i.e.

    -----

    Entity updatedRecord = (Entity)context.InputParameters["Target"];

    var name = updatedRecord["name"].ToString();

    ------

    2. Only the field which are updated will be available in the Target. So if you have updated field A, B C then only these fields will be present.

    3. It is not required to have a field on form to update. You can simply update any field i.e.

    ------

    Entity recordToUpdate = new Entity("account", _accountId);

    recordToUpdate["name"] = "New Name";

    service.update(recordToUpdate);

    ------

    You may want to refer the images concepts in plugin as it seems like you want to retrieve the values which are not updated.

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

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

    Also, there is a concept of filtering the atrribute during the plugin registeration i.e. if you want to trigger your plugin only when certain field are updated (and not all), you can set filtering the the plugin step-

    community.dynamics.com/.../use-of-filtering-attributes-in-plugin-registration

    community.dynamics.com/.../crm-2011-2013-2015-mastering-plugin-registration-filtering-attributes

    Hope this helps.

  • AM-22040756-1 Profile Picture
    407 on at

    Hi Ravi,

    Thanks for ur explaination

  • Suggested answer
    Rajkumar Rajaraman Profile Picture
    on at
  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    You will not want your plugim to trigger always if the the field which is ipdated doesnt concern you plugin logic.

    Example assuming you have a pligin which create a task when some field is changed, if you dont set attribute filtering then you plugim will trigger even if yoir field hasnt change

    Hope this helps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Ciprian  P Profile Picture

Ciprian P 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans