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
Hi Andrii,
Sure. points taken.
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.
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.
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
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;
Checking field under input property bag collection will be the best option in this case instead of doing it from plugin image.
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
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
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156