Create Process Instance

API Type

REST

HTTP Method

POST

Description

Creates a process instance for a specified process instance ID and parameters.

Good to Know

URL Format (OnPremises, Private Cloud)

https://[domain]:[port]/AgilePointServer/Workflow/CreateProcInst

URL Format (OnDemand)

https://[domain]:[port]/AgilePointService/Workflow/CreateProcInst

Request Parameters

NameDescription
NoneNot Applicable

Request Body Properties

NameDescription

Attributes

Function:
Name-value pairs associated with a custom ID.
Type
NameValue
Accepted Values:
A valid custom ID with an associated name.

blnStartImmediately

Function:
An obsolete, legacy parameter that must be true.
Type
bool
Accepted Values:
True

CustomID

Function:
A work object ID specified within a process instance.
Type
string
Accepted Values:
One valid work object ID.

Initiator

Function:
Specifies the user who initiates a process.
Type
string
Accepted Values:
A valid user name.

ProcessID

Function:
The process definition ID for a released process definition.
Type
string
Accepted Values:
A valid process definition ID.

ProcessInstID

Function:
A process instance ID for the process instance you are creating.
Type
string
Accepted Values:
A unique, 32 character process instance ID.

If you set this value to null, the AgilePoint Server generates the ID.

ProcInstName

Function:
A unique process name that is associated with the process definition.
Type
string
Accepted Values:
A unique process instance name up to 1024 characters.

SuperProcInstID

Function:
A process instance ID that acts as a parent process instance of the process instance that is intended to create. In other words, this is the ID of the process instance on which you want to base your new process instance.
Type
string
Accepted Values:
A valid, unique 32-character process instance ID.

WorkObjID

Function:
An ID for an object, such as a document, that is associated with the process instance.
Type
string
Accepted Values:
A valid, unique 256-character ID.

Even though the field size is 256 characters, in common practice, this will usually return a 32-character GUID.

WorkObjInfo

Function:
Usually this parameter is used to hold supplemental information about the work object, such as a URL for a document, within the process instance.
Type
string
Accepted Values:
A string up to 1024 characters.

These properties are based on the class CreateProcInstHelper

JavaScript Code Example

$("#btnCreateProcInst").click(function () {

  $.ajax({
    url: "https://mydomain:9011/AgilePointServer/Workflow/GetUUID",
    type: "GET",
    success: function (data) {
      $("#Hidden1").val(data);

      var JSONObject = {
        ProcessID: "55D6D7F802B5450D95026297ADCAD8C3",
        ProcessInstID: $("#Hidden1").val(), // "0FD3088F40B640D4AFE41AEEBDAE0004",
        ProcInstName: "Process Map Approval - " + $("#Hidden1").val(),
        WorkObjID: $("#Hidden1").val(), //"0FD3088F40B640D4AFE41AEEBDAE0004",
        WorkObjInfo: null,
        SuperProcInstID: null,
        Initiator: "mydomain\\andy",
        CustomID: $("#Hidden1").val(), //"0FD3088F40B640D4AFE41AEEBDAE0004",
        Attributes: [{ Name: "test1", Value: "test123" },
                     { Name: "test2", Value: "test1234"}],
        blnStartImmediately: true
      };

      $.ajax({
        url: "https://mydomain:9011/AgilePointServer/Workflow/CreateProcInst",
        data: JSON.stringify(JSONObject)
      });
    }
  });
});

Java Code Example

public String CreateProcInst() {

  String URI = "https://mydomain:9011/AgilePointServer/Workflow/CreateProcInst";

  HTTPOperations ops = new HTTPOperations(domain, userName, 
                       password, appID, locale);

  JSONObject postData = new JSONObject();
  
    postData.put("ProcessID", "D91BE666F2044DDEAF5BD202FBBE2467");
    postData.put("ProcessInstID", "P91BE666F2044DDEAF5BD202FBBE2467");
    postData.put("ProcInstName", "Process Map Approval - ");
    postData.put("WorkObjID", "MN1BE666F2044DDEAF5BD202FBBE2467");
    postData.put("WorkObjInfo", "");
    postData.put("SuperProcInstID", "");
    postData.put("Initiator", "mydomain\\andy");
    postData.put("CustomID", "MN1BE666F2044DDEAF5BD202FBBE2467");
    postData.put("Attributes", "");
    postData.put("blnStartImmediately", "true");
    return ops.POSTMethod(URI, postData.toString());
  return "";
}

C# Code Example

public string CreateProcInst()
  {
    string URL = "https://mydomain:9011/AgilePointServer/Workflow/CreateProcInst";

    string jsn = "{
      \"ProcessID\":\"E357D828D30840619AEC176913107B34\",
      \"ProcessInstID\":\"4802495DCA8840EFAEE2943028EFAFEE\",
      \"ProcInstName\":\"Testmail-9B29EC6254C64769BDE19D18A876B9A5\",
      \"WorkObjID\":\"4909A27224CE41BEA2FAB52A026CBBC5\",
      \"WorkObjInfo\":\"" + null + "\",
      \"SuperProcInstID\":\"" + null + "\",
      \"Initiator\":\"mydomain\\andy\",
      \"CustomID\":\"0FD3088F40B640D4AFE41AEEBDAE0004\",
      \"Attributes\":[{\"Name\":\"Test\",
      \"Value\":\"Tom\"}],
      \"blnStartImmediately\":true}";

    HTTPOperations ops = new HTTPOperations(domain, this.userName, 
                         password, appID, locale);

    return ops.POSTMethod(URL, jsn);
  }

cURL Code Example

curl --header "Content-Type: application/json" 
                         --header "Authorization:Basic QVAtNDI0XEFkbWluOnBhc3M=" 
                         --request POST 
                         --data {\"CustomID\":\"827128D244B4F4D91177617E9B21F51E\",
                         \"Initiator\":\"mydomain\\andy\",
                         \"ProcInstName\":\"SampleProcessModel-2017-07-05T18:06:49:370\",
                         \"ProcessID\":\"827128D244B4F4D91177617E951A326F\",
                         \"ProcessInstID\":\"827128D244B4F4D91177617E9B21F51D\",
                         \"SuperProcInstID\":\"827128D244B4F4D91177617F0180A8DB\",
                         \"WorkObjID\":\"827128D244B4F4D91177617E9B21F51E\"}
                         https://mydomain:9011/AgilePointServer/Workflow/CreateProcInst

Output

WFEvent object that provides the status of the transaction. The possible statuses are:

  • Sent - Indicates event has been sent to engine for processing.
  • Failed - Indicates event failed to process.
  • Processed - Indicates event has been processed successfully.
  • Canceled - Indicates event was canceled.
  • Deferred - Indicates event does not need to be sent immediately.

JSON Response Body Example

{
  "ActivityInstID": "",
  "AutoStart": true,
  "CustomAttributes": null,
  "Diagnostic": true,
  "EndDate": "\/Date(928149600000+0000)\/",
  "Entries": 1,
  "Error": null,
  "EventID": "4D321D98F53040238A9E619F6D061C35",
  "EventName": "CreateProcessInstance",
  "HighPriority": true,
  "ParamsXml": "<?xml version=\"1.0\" encoding=\"utf-8\"?>
                <WFEvent>...<\/WFEvent>",
  "ParentProcInstID": "",
  "ProcDefID": "5990FB41783F4C7F86E3452AFD62BB8E",
  "ProcInstID": "AE51C821020D4EA498E4B8A37476BA2D",
  "ProcInstName": "xyz - ",
  "Sender": "mydomain\\administrator",
  "SentDate": "\/Date(1394136973755+0000)\/",
  "SourceWorkItemID": "",
  "Status": "Sent",	
  "UserID": "F891306E42D56C8D6892172210AC75D1B1588010
             CBE1DDC25B73F5FAF3150018C8E23C2E75FC94F9
             B28AAD995769C2C5 BF1C25251A18BE0A83F1D53
             45A807FBB87BED155D4D09D2C2677AD86E13018E
             28613E4EBFBEB53C90B4C428ECE625F63",
  "WorkItemID": "",
  "WorkObjectID": "0C5857DFAEF14655B42FF8932BA489B2",
  "WorkObjectInfo": ""
}

Supported Versions

AgilePoint v5.0 R2 and higher

Code Examples in the AgilePoint NX Documentation

The AgilePoint NX Product Documentation is intended as a basic reference to help you understand how to complete basic coding tasks, such as make API or JavaScript method calls. Code examples that show specific use cases, the solutions to specific business problems, or detailed implementation scenarios are outside the scope of the AgilePoint NX Product Documentation. For specific and/or advanced types of examples that may better meet your requirements, AgilePoint provides several resources:

  • AgilePoint Community Forums - A free, AgilePoint-moderated, crowd-sourcing user forum where you can ask questions about specific techniques, the solutions to use cases, workarounds, or other topics that may not be covered in the Product Documentation.
  • Professional Services - If you can not find the information you need for your specific business problem, mentoring is available through AgilePoint Professional Services.
  • Personalized Training - AgilePoint can provide personalized training for your organization. To request personalized training, contact AgilePoint Sales.