Change Action Approval (ApprovalSchemaInitialization)

An opening ID is an entry point used to customize business logic. The change action approval opening ID lets you define the approval schema for change actions.

Note: For more information about customization by business rules, see Customization by Business Rules.

This page discusses:

General Information

This opening ID is invoked:ApprovalSchemaInitialization

This opening ID is used to customize the approval schema for change actions.

The table below provides you with information related to the definition of the Opening ID.

Definition Description
PLM Opening ID ApprovalSchemaInitialization
Customization intent Computation
Execution context Server

Input Objects

Input objects must be of the following types:

  • ThisObject: Change action
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter Name Type Read or Write Comments
ChangeAction Object Read The change action for which approval is required.
ImpactedObjects List of objects Read List of objects to be approved.
Approvers List of strings Read List of approvers connected to a change action.
ComputedApprovalSchema Feature Write -

Sample

The following sample describes how to define approval schema for change actions.

/* Define constants */
/* Input elements */
let promotedChangeAction("Change Action")
let impactedObjectsList(List)
let approvalSchema(ChangeApprovalSchema)

/* Elements to be used to create the approval schema */
let approvalSchemaLevel(ChangeApprovalSchemaLevel)

/* Elements to be used to process the logic */
let impactedObjectsListSize(Integer)
let impactedObjectsListIterator(Integer)
let impactedVPMReference(VPMReference)
let impactedPart(Part)

/* Retrieve the elements provided in input */
set promotedChangeAction = Parameters->GetAttributeObject("ChangeAction")
set impactedObjectsList = Parameters->GetAttributeObject("ImpactedObjects")
set approvalSchema = Parameters->GetAttributeObject("ComputedApprovalSchema")

/* Apply the logic based on the inputs */
if(promotedChangeAction.organization == "MyCompany")
{
    set approvalSchemaLevel = approvalSchema.addApprovalSchemaLevel(false)
    set impactedObjectsListSize = impactedObjectsList.Size()
    set impactedObjectsListIterator = 1

    for impactedObjectsListIterator while impactedObjectsListIterator<=impactedObjectsListSize
    {
        set impactedVPMReference = impactedObjectsList->GetItem(impactedObjectsListIterator)
        set impactedPart = impactedObjectsList->GetItem(impactedObjectsListIterator)

        if(impactedVPMReference<>NULL)
        {
            approvalSchemaLevel.addApprovalTask("taskTitle","taskInstructions",false,"User1", false, "Route Start Date", "2")
        }
        if(impactedPart<>NULL)
        {
            approvalSchemaLevel.addApprovalTask("taskTitle","taskInstructions",false,"User2", false,"", "")
        }

        set impactedObjectsListIterator = impactedObjectsListIterator + 1		
    }
}

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 the following 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")

where,
Arguments in Sequence Description
String Title of the task.
String Instructions given for the task.
Boolean true or false value to allow delegation of the task.
String Identifier or the trigram of a person, or a user group that has a unique title.
Important:
  • You can define identifier or the trigram of a person for addApprovalTask only.
  • On the cloud, you can define user groups for the fourth argument using the group URI in the <uuid:0542a6cf-f94e-4474-911f-fc13d0a1012c> format.
Boolean Indicates if the fourth argument is a person (false) or a user group (true).
Note: This argument is not applicable for addApprovalTaskWithOwnerAssignment.
String Indicates DateOffSetFrom for the task.
String Indicates the due date in days from the previous argument.