0

I have two SP 2013 workflows. One (WF1) does a number of things, but at the end of WF1, I'm calling another SP 2013 workflow (WF2) using REST. WF1 runs both on create and change and conditionally starts WF2 if certain fields are populated.

My challenge is that when WF1 runs the first time (on create) and calls WF2, the call to WF2 responds with "BAD REQUEST". However, if I run WF1 again (on change), the call to WF2 works just fine.

I can't seem to figure out why it doesn't work the first time but works fine the second time. I've seen some weird timing things with SharePoint, but this one seems odd.

The URL format I'm using to start the workflow is below. I've used this same format to successfully start other workflows. I also know it's a valid URL because it works on the second try. I've also tried the call both within an App Step and outside with no difference.

https://site/_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='xxx',itemID=xx)

I appreciate any help that you can provide.

  • 1
    Not knowing your steps, maybe you need to add a pause in there to allow the item to be created before workflow 2 begins if it is based on other fields. – user2004758 Feb 9 at 10:59
  • The item being created is what starts WF1. Calling WF2 is the very last thing WF1 does, so it's already processed all of its steps. The ID is valid as well well before that final step as I use it in the first step of WF1 to generate a formatted ID. It's almost as if WF1 has to have completed once before calling another WF works. If I have WF2 trigger on create, it works fine. It's only when calling WF2 from WF1 the first time that I have any issue. – Joe R Feb 10 at 0:37
  • To clarify, WF1 and WF2 are being run on the same item. – Joe R Feb 10 at 0:54

Your Answer

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

Browse other questions tagged or ask your own question.