Special Functions

AddPerformer

Purpose

Adds one or more performers (users or groups) to a workflow process with a specified role.

How It Works

1. Parameters: The function reads the Targets attribute from the activity, which should be a comma-separated string in the format:
email_field,role_name[,append_suffix]
– email_field – The attribute name containing the email address(es) or group name(s)
– role_name – The role to assign to the performer
– append_suffix (optional) – A suffix to append to group names
2. Logic Flow:
– Retrieves the value from the specified email attribute on the collaboration’s attribute object
– Supports multiple emails/groups separated by commas
– If the value contains @, it’s treated as a user email and added via CollabService.addUserMember()
– Otherwise, it’s treated as a group name and added via CollabService.addGrpToProcess()

Usage Example

To use AddPerformer in a workflow activity:

1. Set the Targets attribute on the activity to something like:
ApproverEmail,Approver
1. This would read the ApproverEmail attribute from the form and add that user with the role Approver.
2. For multiple performers from a comma-separated list:
ReviewerEmails,Reviewer
2. If ReviewerEmails contains user1@example.com,user2@example.com, both users would be added as Reviewer.
3. For groups with a suffix:
DepartmentName,Manager,_Managers
3. If DepartmentName is Sales, it would add the group Sales_Managers with the role Manager.

 

AssignPerformer

Purpose

Assigns a user (specified by an attribute value) as the performer/actor for the activity that immediately follows the current activity.

How It Works

1. Parameter: Reads the Targets attribute from the current activity, which should contain the name of an attribute holding the user email(s).
2. Logic Flow:
– Gets the attribute object from the collaboration
– Reads the email value from the attribute specified in Targets
– Supports multiple comma-separated emails
– For each email:
– Looks up the user via DataService.getUser()
– Iterates through all activities to find the next activity (the one immediately after the current activity)
– Adds the user as a member of the collaboration
– Sets the Actors attribute on the next activity to the user email
3. Result Tracking: Updates the current activity with:
– ActivityResult: “Completed” on success, “Failed” on failure
– FunctionStatus: “Successful”, “User attribute not defined”, “User not found”, or “Activity not found”

 

AssignUsersToSupplierRoles

Purpose

Looks up a Supplier data object and assigns users to the collaboration’s roles by matching role names to attributes on the Supplier record.

How It Works

1. No Parameters Needed: Unlike AddPerformer, this function doesn’t use the Targets attribute – it works automatically based on conventions.
2. Logic Flow:
– Reads SupplierID from the collaboration’s attribute object
– Looks up the Supplier record from the Supplier data object where SupplierID matches
– Gets all roles defined on the collaboration
– For each role:
– Gets the RoleName (e.g., “BuyerContact”, “SupplierAdmin”)
– Looks for an attribute with the same name on the Supplier record
– If found and not empty, adds that user to the process with that role

Example Scenario

If your collaboration has these roles:
– BuyerContact
– SupplierAdmin
– QualityManager

And your Supplier record has:
┌────────────────┬──────────────────────┐
│ Attribute │ Value │
├────────────────┼──────────────────────┤
│ SupplierID │ SUP001 │
├────────────────┼──────────────────────┤
│ BuyerContact │ buyer@company.com │
├────────────────┼──────────────────────┤
│ SupplierAdmin │ admin@supplier.com │
├────────────────┼──────────────────────┤
│ QualityManager │ quality@supplier.com │
└────────────────┴──────────────────────┘
The function will:
1. Add buyer@company.com with role BuyerContact
2. Add admin@supplier.com with role SupplierAdmin
3. Add quality@supplier.com with role QualityManager

Prerequisites

– The form/collaboration must have a SupplierID attribute populated
– A Supplier data object must exist with matching SupplierID
– Supplier record attributes must match the role names exactly

Error Handling

– Throws exception if SupplierID is not assigned
– Throws exception if Supplier record not found
– Silently logs and continues if an individual user can’t be added (doesn’t fail the whole operation)

 

CallPythonScript