Sample
The following sample lets you define the approval schema for change requests.
/* Define constants */
/* Input elements */
let promotedChangeRequest("Change Request")
let approvalSchema(ChangeApprovalSchema)
/* Elements to be used to create the approval schema */
let approvalSchemaLevel(ChangeApprovalSchemaLevel)
/* Retrieve the elements provided in input */
set promotedChangeRequest = Parameters->GetAttributeObject("ChangeRequest")
set approvalSchema = Parameters->GetAttributeObject("ComputedApprovalSchema")
/* Apply the logic based on the inputs */
if(promotedChangeRequest.organization == "MyCompany")
{
set approvalSchemaLevel = approvalSchema.addApprovalSchemaLevel(false)
approvalSchemaLevel.addApprovalTask("taskTitle","taskInstructions",false,"DemoLeaderAllCS", false, "Route Start Date", "2")
}
For ChangeApprovalSchema
setDemoteOnRejection(Boolean) is used to define if the connected change
object is automatically demoted to the previous state when a task is rejected.
addRouteTemplate(String, String) is used to define the approval schema
based on an existing route template. Not compatible with
approvalSchemaLevel definition. The first argument is the Route Template
name and the second argument is the Route Template revision. Specify * as
second argument to use the latest route template revision.
addApprovalSchemaLevel(Boolean) is used to add a level to the approval
schema level returned by the method. If you specify true, only one of the
task on this level must be approved to start the next level. If you specify
false, all tasks on this level must be approved to start the next
level.
setDeferAutoStopOnRejection(Boolean) is used to stop the route on deferred
event in case of rejection. The attribute is false by default.
setTaskEdits(String) is used to define tasks on the generated route when
the route is not generated from a route template. You can specify the input among following
four values:
- ModifyDeleteTaskList
- ExtendTaskList
- ModifyTaskList
- MaintainExactTaskList
setSelectUsersFromUserGroups(Boolean) is used, before the route starts, to
assign all the approval tasks to the users from a user group. For example,
approvalSchema.setSelectUsersFromUserGroups(true)
For ChangeApprovalSchemaLevel
addApprovalTask(String, String, Boolean, String, Boolean, String , String)
is used to add an approval task to a level.
addApprovalTaskWithOwnerAssignment(String, String, Boolean, String, String,
String) is used by the route owner to define task assignment. Task assignment can
be done to a specific user group or the fourth argument can be kept blank for free
assignment of the task. For example,
approvalSchemaLevel.addApprovalTaskWithOwnerAssignment("taskTitle","taskInstructions",false,"UserGroupTitle",
"Route Start Date", "2")
The first argument is the task title.
The second argument is the task instructions.
The third argument is to allow delegation (true) or not
(false).
The fourth argument is the identifier or the trigram of a person, or a user group that has
a unique title.
The fifth argument indicates if the fourth argument is a person (false) or
a user group (true).
The sixth argument indicates DateOffSetFrom for the task
The seventh argument indicates the due date in days from the previous argument.