I'm trying to add custom statuses to my SharePoint workflow but am encountering 'Error Occurred' when I try to set them. I've tried different ways of going about this.
For example in my SetState_MethodInvoking I've tried the following:
SetAssignmentState.State = 15;
This makes the workflow runtime throw:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
and
((SetState)sender).State = 15;
This doesn't error, however the status is empty after this.
I've correctly added the statuses themselfs into the workflow definition within the MetaData tag:
<ExtendedStatusColumnValues>
<StatusColumnValue>Hello World</StatusColumnValue>
</ExtendedStatusColumnValues>
After some trial and error I discovered that the error occurs because the SetState activity is nested within a while activity. I read that the correlation token should be set to that of the workflow, as it isn't task dependent. I've since tried creating a token just for this activity with different parents but I've not been able to find a combination that works.
I'd very much appreciate any advice about what might be the cause of this error when the activity is nested inside another.