Create Process Instance

API Type

REST

HTTP Method

POST

Description

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

URL Format (On Premises)

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

URL Format (AgilePoint for Azure)

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

Request Parameters

Name Description
None Not Applicable

Request Body Properties

Name Description

Attributes

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

blnStartImmediately

Definition:
An obsolete, legacy parameter that must be true.
Type
bool
Allowed Values:
True

CustomID

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

Initiator

Definition:
Specifies the user who initiates a process.
Type
string
Allowed Values:
A valid user name.

ProcessID

Definition:
The process definition ID for a released process definition.
Type
string
Allowed Values:
A valid process definition ID.

ProcessInstID

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

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

ProcInstName

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

SuperProcInstID

Definition:
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
Allowed Values:
A valid, unique 32-character process instance ID.

WorkObjID

Definition:
An ID for an object, such as a document, that is associated with the process instance.
Type
string
Allowed 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

Definition:
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
Allowed 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: "demo3\\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 CreateProcessInstance(String ProcessID, String ProcessInstID,
  String ProcInstName, String WorkObjID, String WorkObjInfo,
  String SuperProcInstID, String Initiator, String CustomID,
  String Attributes, boolean blnStartImmediately) {

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

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

  JSONObject postData = new JSONObject();
  try {
    postData.put("ProcessID", ProcessID);
    postData.put("ProcessInstID", ProcessInstID);
    postData.put("ProcInstName", ProcInstName);
    postData.put("WorkObjID", WorkObjID);
    postData.put("WorkObjInfo", WorkObjInfo);
    postData.put("SuperProcInstID", SuperProcInstID);
    postData.put("Initiator", Initiator);
    postData.put("CustomID", CustomID);
    postData.put("Attributes", Attributes);
    postData.put("blnStartImmediately", blnStartImmediately);
    return ops.POSTMethod(URI, postData.toString());
  } catch (JSONException e1) {
    e1.printStackTrace();
  }
  return "";
}

C# Code Example

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

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

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

    return ops.POSTMethod(URL, jsn);
  }

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": "demo3\\administrator",
  "SentDate": "\/Date(1394136973755+0000)\/",
  "SourceWorkItemID": "",
  "Status": "Sent",	
  "UserID": "F891306E42D56C8D6892172210AC75D1B1588010
             CBE1DDC25B73F5FAF3150018C8E23C2E75FC94F9
             B28AAD995769C2C5 BF1C25251A18BE0A83F1D53
             45A807FBB87BED155D4D09D2C2677AD86E13018E
             28613E4EBFBEB53C90B4C428ECE625F63",
  "WorkItemID": "",
  "WorkObjectID": "0C5857DFAEF14655B42FF8932BA489B2",
  "WorkObjectInfo": ""
}

Supported Versions

AgilePoint BPMS v5.0 R2 and higher