Hi i want to use LocalPluginContext, to get preimage entity, but i don't know why its missing, do i need to add any reference for this or it's already depecreated. so i need to get updated value from field and preupdated value from field and when im looking on the internet i found this usefull answer but i can't get LocalPluginContext
protected void ExecuteYourPlugin(LocalPluginContext localContext)
{
IPluginExecutionContext pluginContext = localContext.PluginExecutionContext;
// Get Target Entity
var updateEntity = (Entity)pluginContext.InputParameters["Target"];
// Get PreImage Entity
var preEntity = (Entity)localContext.PluginExecutionContext.PreEntityImages["PreImage"];
// Is in Update
if(localContext.PluginExecutionContext.MessageName.ToLower() == "update")
{
var fieldName = string.Empty;
// If Contains, Extract value from Target Entity
if(updateEntity.Contains("new_fieldname"))
{
// Cast the fields according their type
fieldName = updateEntity["new_fieldname"].toString();
}
// Else extract the value from preImage
else if(preEntity .Contains("new_fieldname"))
{
// Cast the fields according their type
fieldName = preEntity["new_fieldname"].toString();
}
}
can someone help here thanks.
*This post is locked for comments
I have the same question (0)