createWork(className, options)
Creates a work object for a specified class and flow type and displays the work object in a target container.
Returns
A Promise associated with the action.
Parameters
Name | Type | Description | Required |
className | string | Name of the case class for which the work object should be created. | ✅ |
options | object | The JavaScript object that contains the properties required for creating the work object. | ❌ |
The following table contains the properties of the options object:
Name | Type | Description | Required |
flowType | string | The type of flow based on which the work object is created. | ❌ |
containerName | string | The name of the container that displays the created work
object. Example:
| ❌ |
openCaseViewAfterCreate | boolean | The flag that determines if the new case view should be displayed when a case is created. | ❌ |
startingFields | object | The JSON object that contains the fields to be set while creating a case. | ❌ |
Usage example
In this example, the API creates a work object within the primary
container with the OPB1HW-SpaceTra-Work-RequestApproval
class and
the pyStartCase
flow type.
const options = {
flowType: "pyStartCase",
containerName: "primary",
startingFields: {
FirstName: "Adam",
LastName: "Smith",
Vehicle: {
Make: "Honda",
Model: "Accord"
}
}
};
const createWorkPromise = getPConnect().getActionsApi().createWork("OPB1HW-SpaceTra-Work-RequestApproval", options);
createWorkPromise.then(() => {
// create work success handling
}).catch(() => {
// create work failure handling
});
Previous topic changeHandler(pConn, event) Next topic deleteCaseInCreateStage(containerItemID)