Remove Record URL parameter...

Feb 26, 2017 at 11:36 PM
Is there any reason you can't remove the second input parameter (Parent Record URL)? If I'm understanding the code correctly, it parses the record URL to get the entity type code and ID. The ETC is used to lookup the entity name. Instead, you should be able to get the same info from the workflow context, eliminating the need to parse the URL and make a metadata service call. You could reduce the entire custom workflow to basically four lines:
 var calculateRollup = new CalculateRollupFieldRequest();
 calculateRollup.FieldName = FieldName.Get(executionContext);
 calculateRollup.Target = new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId);

 var response = (CalculateRollupFieldResponse)service.Execute(calculateRollup);