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)

Triggering Update Event with New ColumnSet (True) (CRM 2015)

(0) ShareShare
ReportReport
Posted on by

Hello all,

Pretty quick question here.

If you retrieve an entity and use New ColumnSet(True) instead of specifying the attributes and you only update or change ONE attribute, will other update events for the other fields still be triggered even though they are not changing?

For example, you retrieve Account Entity with new ColumnSet (True), change field one and call an update.

Will another plugin that is registered on the update of field 2 fire because that field was included in the retrieval even though you didn't explicitly change the value of that field?

Thank you,

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    It depends on the update part, 

    Example :  if your workflow/plugin trigger on address changed.

    Entity account = new Entity("account")

    account.ID = Guid;

    account.Attributes["name"] = "abc";

    m_service.Update(account);

    In this case, this wont trigger the workflow/Plugin.

    Example 2 : if your workflow/plugin trigger on address changed.

    If you updated the whole entity.

    QueryExpression qe = new QueryExpression();
    qe.EntityName = "account";
    qe.ColumnSet = new ColumnSet(true);

    EntityCollection ec = m_service.RetrieveMultiple(qe);

    for(var i = 0; i < ec.Entities.Count; i ++)
    {
    m_service.Update(ec.Entities[i]);
    }

    In this case, this will trigger the workflow/plugin.

    Please only specify the fields you wanted to update, else in future in might cause a lots of trouble.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    Although I have not tested in plugin but it should not fire, because CRM will identify intelligently if value is change or not, for example create on workflow and set it to execute on some field change, now open entity record and change other fields and save your workflow won't fire, it will only fire if you will change that particular field.

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

    Hi,

    I've built one scenario for you to see. 

    I built a workflow to be triggered on name changed.

    0020.15.png

    this is the code

    6874.13.png

    Result

    4336.11.png

     

    Example 2

    If you update only specific attribute

     

    0020.15.png

    Result

    7827.14.png

     

    no workflow will get trigger as long as the field is not register in any trigger point.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    The retrieval method is irrelevant of the update method.

    If you call a Retrieve which returns an Entity record and you call an update on that same Entity record, the Update will update on all the retrieved values:

    Entity myEntity = service.Retrieve(entityName, entityId, new Columnset(true);

    myEntity["attribute1"] = "New Value";

    service.Update(myEntity);

    If you call the Update only on the fields that you need, and create a new instance of the Entity, it will only update the required fields:

    Entity myEntity = service.Retrieve(entityName, entityId, new Columnset(true);

    Entity newEntity = new Entity(entityName);

    newEntity.Id = entityId;

    newEntity["attribute1"] = "New Value";

    service.Update(newEntity);

    Hope this helps.

  • Verified answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Hello,

    The answer is Yes.

    If you use Column Set(true) and do service.update(entityObj). It will perform an update on all the fields Reason being, you are passing entity object while performing an update on the database which contains the reference of all the fields. Hence, if any another plugin/workflow is registered in any field update of the same entity. It will trigger and impact the system performance. So I would always recommend avoiding column set(true) in your code.

    This article is helpful for you:

    https://community.dynamics.com/crm/b/crmbusiness/archive/2012/09/17/crm-2011-in-plugins-only-select-the-fields-you-need-and-not-columnset-true

    If my answer helped to resolve your issue, kindly verify it by clicking 'Yes'. It would be helpful to the other community members seeking to resolve a similar issue.


    Cheers
    Arpit
    https://arpitmscrmhunt.blogspot.in

     

     

  • Community Member Profile Picture
    on at

    Thank you to everyone that replied and I truly appreciate it.

    I was under the assumption that because the field did not change (even though we are retrieving all of them) it would not trigger an update event because the field was not being changed.

    This was clearly a bad assumption.

    Thanks again!

    P.S - To continue providing help on this topic for others - I found this link msdn.microsoft.com/.../microsoft.xrm.sdk.query.columnset.allcolumns.aspx which does contain an important section regarding the retrieval of all fields and it triggering an update event even though they are unchanged.

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