none
Using Rest API call to start workflow with parameters in Sharepoint Designer 2013

    Question

  • I'm currently trying to call a 2013 workflow from another 2013 workflow using the Call HTTP Web Service action. I set a Post request to ".../_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='[variable:wkflw_id]',itemId='1')."


    Everything work fine for that call. The trouble is that I need to send a number as the parameter for the workflow being called.


    Using a Dictionary as the request body didn't work. I build a Dictionary that convert into {"__metadata":{"type":"SP.KeyValue"},"Key":"client_col_num","Value":1,"ValueType":"Edm.Int32"}. When I add that Dictionary as the value for the "payload" key of the request body Dictionary, the call returns "startObject found when expected startArray node" error. The body need to be {"payload": [{...}]} but got {"payload": {...}} instead.


    Changing the Post request to ".../StartWorkflowOnListItemBySubscriptionId(subscriptionId='...',itemId='1',payload='[{"__metadata":{"type":"SP.KeyValue"},"Key":"client_col_num","Value":1,"ValueType":"Edm.Int32"}]')" result in a BadRequest error with an empty message.

    Monday, December 19, 2016 9:55 PM

All replies

  • Hi,

    Could you talk more about your scenario?

    Suppose you want wf1 to trigger wf2. Could you tell us what does wf1/wf2 do? And what’s parameter you want to use in wf2?

    Thanks,

    Dean Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, December 21, 2016 11:30 AM
    Moderator
  • Hi Dean, i'm with the same error.

    I have a SharePoint Online Workflow configured with initialization parameters and i want to start this workflow from another workflow by "Call Http Web Services". I see this post https://sharepoint.stackexchange.com/questions/177552/cannot-start-workflow-from-js-in-display-form that uses another way to process request passing parameter on "RequestContent" from Parameter for "Request".

    I tried to execute this ajax script but it dosen't work.

    I can start a workflow using this approach applied in Workflow using a Http Call, but Initialization Parameter is not being overwritten.

    So, second workflow that just Log a message to history, it shows Default Value of Parameter.

    Do you have some idea to resolve it?



    Friday, June 23, 2017 6:48 PM