0

I have two SPLists. On List1 there is reusable workflow (with some functionality created in Visual Studio) that is changing some fields on List2. When item on list2 is updated then on list2 should be started another workflow. Somehow workflow on list2 doesn't start. When I update record from list2 manually then workflow starts correctly.
This is code from workflow on list1:

foreach (SPListItem item in ((SPList)listToChange).Items)
{
if (item.Fields.ContainsField(TargetFieldToUpdate))
{
if (item["Release ID"] != null && item["Release ID"].ToString() == currentItem["ReleaseID"].ToString())
{
item[TargetFieldToUpdate] = true;
 item.Update();
}
}
} 

What shall I change to make workflow from list2 start?

2

You would have to either start the workflow programmatically, or find a way for workflows to be started by the System Account. When changes are made programmatically, the associated modified by is a System Account. SP has a built in feature which does not start workflows when a change is made by the system account (which is good in ways, but can be frustrating in situations such as this). There is a PowerShell script which many use to allow this sort of thing to happen for the purpose of incoming email. Though the script is intended for email situations, I am not sure whether SP will be able to discriminate or if it just broadly allows workflows to be started by System Account on that list. It may work for you.

Enable system account to start workflow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.