Hi all,
Currently I'm developing a custom workflow activity that retrieve a value form a lookup field and assign it to an output parameter. I have used the below code:
Guid fieldId = new Guid(); if (Entity.Attributes.Contains("new_lookupfield") == true) { fieldId = ((EntityReference)Entity.Attributes["new_lookupfield"]).Id; OutParam.Set(context, new EntityReference("new_entity", fieldId)); }
My problem is with setting the value of the output parameter when the lookup field is empty. I have tried to use
OutParam.Set(context, new EntityReference("new_entity", fieldId));
Outside the if condition but it throws and invalid argument exception
Please advise..