Trigger SharePoint Designer Workflow using SP Services
There are times when you want to first process some information in your code and then pass those information as parameter in the workflow and start it. Fortunately you can trigger the SharePoint workflow using SP Services You will need 2 files jquery.SPServices.min.js spservices-startworkflow.js Include the below references:
1 2 3 4 5 6 |
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script> <script type="text/javascript" src="/_layouts/15/sp.js"></script> <script type="text/javascript" src="/_layouts/15/sp.core.js"></script> <script type="text/javascript" src="/_layouts/15/sp.workflowservices.js"></script> <script type="text/javascript" src="../SiteAssets/js/jquery.SPServices.min.js"></script> <script type="text/javascript" src="../SiteAssets/js/spservices-startworkflow.js"></script> |
Below is the code:
1 2 3 4 5 6 |
startWorkflow({ listName:"List Name here", itemID:id, //Item ID here parameters:[{Name:"Parameter1", Value:"Value1"},{Name:"Parameter2", Value:"Value2"}], workflowName:"Workflow Name here" }) |