Create Work Item

API Type

REST

HTTP Method

POST

Description

Creates a manual work item.

URL Format (On Premises)

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

URL Format (AgilePoint for Azure)

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

Request Parameters

Name Description
None Not Applicable

Request Body Properties

Name Description

ActivityInstanceID

Definition:
The unique ID for an activity instance.
Type
string
Allowed Values:
A valid activity instance ID.

BusinessTime

Definition:
Determines whether the system calculates the duration using your business time calendar.
Type
bool
Allowed Values:
  • True - The system calculates duration using business time.
  • False - The calculates the duration based on real time.

ClientData

Definition:
Specifies the client data, which identifies a client for AgilePoint Server.
Type
string
Allowed Values:
A string that contains the client data.

If this value is null, the system will keep existing client data. Otherwise the relevant data is overwritten.

Length

Definition:
Specifies the length of time duration.
Type
string
Allowed Values:
A valid time duration length.

Unit

Definition:
Specifies the unit.
Type
string
Allowed Values:
A valid unit.

UserID

Definition:
Specifies the user associated with the work item.
Type
string
Allowed Values:
A valid user ID.

WorkToPerform

Definition:
Represents the task that performed by the participants of the activity.
Type
string
Allowed Values:
A valid work to perform name.

These properties are based on the class CreateWorkItemHelper

JavaScript Code Example

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

  var JSONObject = { 
    ActivityInstanceID: "0DB05C1A1BAB445895CCF46E096AECDD",
                     WorkToPerform: "Test", 
                     UserID: "demo3\\brian.lucas",
                     Length: "2",
                     Unit: "DAY",
                     BusinessTime:true,
                     ClientData: null
  };
  $.ajax({
    url: "https://mydomain:9011/AgilePointServer/Workflow/CreateWorkItem",
    data: JSON.stringify(JSONObject)
  });

});

Java Code Example

public String CreateWorkItem(String ActivityInstanceID,
  String WorkToPerform, String UserID, String Length, String Unit,
  boolean BusinessTime, String ClientData) {

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

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

  JSONObject postData = new JSONObject();
  try {
    postData.put("ActivityInstanceID", ActivityInstanceID);
    postData.put("WorkToPerform", WorkToPerform);
    postData.put("UserID", UserID);
    postData.put("Length", Length);
    postData.put("Unit", Unit);
    postData.put("BusinessTime", BusinessTime);
    postData.put("ClientData", ClientData);
    return ops.POSTMethod(URI, postData.toString());
  } catch (JSONException e1) {
    e1.printStackTrace();
  }
  return "";
}

C# Code Example

public string CreateWorkItem()
  {
    string URI = "http://mydomain:9011/AgilePointServer/Workflow/CreateWorkItem";

    string jsonRequestData = "{
      \"SourceWorkItemID\":\"E48644178C514A95AB457F00A35F1550\",
      \"WorkToPerform\":\"Test123\",
      \"UserID\":\"MYDOMAIN\administrator\",
      \"Length\":\"2\",
      \"Unit\":\"DAY\",
      \"BusinessTime\":\"true\",
      \"bDependent\":\""+true+"\",
      \"ClientData\":\"" + null + "\"}";

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

    return ops.POSTMethod(URI, jsonRequestData);
  }

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": "0DB05C1A1BAB445895CCF46E096AECDD",
  "AutoStart": true,
  "CustomAttributes": null,
  "Diagnostic": true,
  "EndDate": "\/Date(1394148914232+0000)\/",
  "Entries": 1,
  "Error": null,
  "EventID": "B7A7115262B6491CB8809E6AFF31E640",
  "EventName": "CreateWorkItem",
  "HighPriority": true,
  "ParamsXml": "<?xml version=\"1.0\" encoding=\"utf-8\"?>
                <WFEvent>
                  <param name=\"ExpectedTime\" 
                            value=\"2 Day(s)(business time)\" \/>
                  <param name=\"HighPriority\" value=\"True\" \/>
                  <param name=\"ActivityInstID\" 
                            value=\"0DB05C1A1BAB445895CCF46E096AECDD\" \/>
                  <param name=\"ProcInstID\" 
                            value=\"B7F0ACFA610349B4BF10A4DAB8E93458\" \/>
                  <param name=\"UserID\" value=\"demo3\\brian.lucas\" \/>
                  <param name=\"waitWorkPerformed\" value=\"False\" \/>
                  <param name=\"workPerformer\" value=\"Test\" \/>
                  <param name=\"Carbon\" value=\"False\" \/>
                  <param name=\"WorkItemID\" 
                            value=\"D02F4ADD314B46DF91CE32D42B3190CB\" \/>
                <\/WFEvent>",
  "ParentProcInstID": "",
  "ProcDefID": "",
  "ProcInstID": "B7F0ACFA610349B4BF10A4DAB8E93458",
  "ProcInstName": "",
  "Sender": "demo3\\administrator",
  "SentDate": "\/Date(1394148914227+0000)\/",
  "SourceWorkItemID": "",
  "Status": "Sent",	
  "UserID": "demo3\\brian.lucas",
  "WorkItemID": "D02F4ADD314B46DF91CE32D42B3190CB",
  "WorkObjectID": "",
  "WorkObjectInfo": ""
}

Supported Versions

AgilePoint BPMS v5.0 R2 and higher