We were supposed to write a plugin against say entity A which would be updating a related entity B only if the value of one of the attribute(string) in entity A is blank.
The plugin was a post update one , so even though we had registered pre/post image with that particular attribute and as it was null, the property/value wasn’t getting passed.
So there was no way to access it in the entity images.
Only way to access the value was to make use of query expression class to get the value saved in the table for that entity. But we decided to use another approach.
Normally if we set a ForceSubmit on a particular field it is passed as one of the property of inputparameters of the context.
So what we did was set ForceSubmit on the field and then converted the inputparameters properties as Dynamic Entity and were able to get the value of that attribute even in case when it was null/blank.
DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties[“Target”];
if (entity.Properties.Contains(“new_attSchemaName”))
{
String myAttrValue = (string)entity.Properties[“new_attSchemaName”];
if (myAttrValue == “”)
{
//
Bye..
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.
