Tuesday, November 11, 2014

Tricks for working with SetState and SetStateDynamic plugins

There are a couple of tricks to working with SetState and SetState Dynamic plugins.  To get the State that the record is "becoming" you can check the InputParameter "State":

var state = (OptionSetValue) context.InputParameters["State"];
localContext.Trace("Contact State: " + state.Value);

if (state.Value == (int)ContactState.Inactive) return;

To get the Guid of the record, check the PrimaryEntityId property:

Guid targetId = context.PrimaryEntityId;

No comments: