Hello,
I have an entity called Student with two attributes - an OptionSet field called Status and a Lookup field called Faculty.
On a record update (Post-Op) I'd like to trigger a plug-in whenever the Status changes to a certain value.
The record to be updated has a Faculty attached to it already.
My code is as follows -
Entity studentTarget = context.InputParameters["Target"] as Entity; new_student student = studentTarget.ToEntity<new_student>(); if (student.Contains("new_faculty") && student.new_Faculty != null && student.new_Status.Value == 3) {
// some logic
}
But the Faculty attribute returns null.
P.S. When registering a new step to the plug-in , in Filtering Attributes, I included both Faculty and Status attributes.
What could be the problem here?
Is it because the Faculty doesn't change that the attribute returns null? If so, how can I resolve this problem?
Thank you
*This post is locked for comments
in the update message the target contains only the attributes that changed. If you need to access other fields you need to register an image
more details here
Hi
I would first check if the attribute is passed in the entity image before converting to new_student.
you could try something like this
var hasAttribute = studentTarget.Attributes.Contains("new_faculty")
throw new InvalidPluginExecutionException("Faculty attribute passed? : " + hasAttribute); }
If this exception displays true for attribute passed, the problem is in the mapping to early bound class.
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