modifiedby and on

does your workflow carry this undesired effect of updating the modified by/on attributes? Most of the posts i have found deal with it by creating a custom modified on/by attributes and have a preupdate plugin to populate that field. That was our initial thought and then run into the issue of how to filter out preupdate event from that workflow. Well in v4, there used to be a calleorigin from the plugin context which you can use. Even that only tells you if it comes from application, asyncoperation. It doesn’t really tell you exactly from which workflow is the update is originated from.

Here’s how we did it and its based on the fact that you can prevent an update request from updating any attributes by removing that attributes from the target parameter.

1) create a custom bool field which the workflow instance will set to true. Call it “LeaveModifiedAttributesAlone”

2) Create a plugin to trigger on that field only, at a pre-update stage.

3) In the plugin code, remove the modified on/by attributes and also the LeaveModifiedAttributesAlone so it will remain null

4) Change your workflow you want to filter to, in addition to the regular operation, set the bool to true, so the plugin will trigger.

That’s it… its the most elegant solution i can come up with..


About s1301950

Dynamics CRM Developer with more than 5 years of experience in both 4.0 and 2011. Specialized in customization and development in plugins, custom workflows and xrm javascript. Also have more than 10 years of development. Currently engaged in projects using 4.0 with LINQ and Identity framework (WIF)
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s