I noticed that we cannot call a 2013 designer WF from within a 2013 designer WF. Can a workflow be called using rest api. If so are there any examples on how to do it?

1 Answer 1


You can also call the workflow from code. I have a custom .aspx and in there I called a 2013 WF via a button.

Here how I start the workflow:

$("#anmelden"+id).click(function(e) {       

And here the function:

function startWorkflow(itemID) {

        //alert("go for it");

        var subID = "5a7f927a-3137-47e8-85d7-39f03f85521d";
        var context = SP.ClientContext.get_current();
        var web = context.get_web();

        // Get Current User         
        var loginName = "";
        var userid = _spPageContextInfo.userId;     
        var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";       
        var requestHeaders = { "accept" : "application/json;odata=verbose" };

          url : requestUri,
          contentType : "application/json;odata=verbose",
          headers : requestHeaders,
          success : onSuccessA,
          error : onErrorA

        function onSuccessA(data, request){

            var loginName = data.d.Title;

            //alert("Currently logged in: " + loginName);
            if (loginName != ""){

                var wfServiceManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, web);

                var subscription = wfServiceManager.getWorkflowSubscriptionService().getSubscription(subID);


                    function(sender, args){
                        console.log("Subscription load success. Attempting to start workflow.");        
                        var inputParameters = {};

                        wfServiceManager.getWorkflowInstanceService().startWorkflowOnListItem(subscription, itemID, inputParameters);

                            function(sender, args){ 
                            console.log("Successfully starting workflow.");     
                            function(sender, args){ 
                                console.log("Failed to start workflow.");
                                console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());
                        console.log("Failed to load subscription.");
                        console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());



        function onErrorA(error) {


The variable subID is the ID of your workflow. You can get it if you go to your published workflows and copy the link of the workflow button.

If it is a SharePoint 2013 Workflow you should get a URL similar to this:

javascript:StartWorkflow4('5a7f927a-3137-47e8-85d7-39f03f85521d', '15', '{74AC618F-3714-43B8-90AB-349EA4F6D8DB}')

As you see the first part starting with 5a7... is the ID you need.

Hope this helps to get you started.

  • :) Thank you @Patrick. This is good to know, but I am looking for a SP designer solution. Thanks again.
    – Aamir
    Commented Mar 23, 2016 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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