Unified Change Management

Creating Custom Assignment Rules

Custom Workflow Assignment Rules require developing server methods that implement assignment logic specific to your business requirements.

Development Requirements

Method Requirements

Workflow Assignment Rule methods must satisfy the following requirements:

Method Type: VB/C# server method

Method Context:

  • Receives Workflow Process item (Target = “Workflow”)
  • Or receives Activity item (Target = “Activity”)

Required Attributes:

  • Method can access context_type_id and context_item_id attributes
  • These provide the source Change Item information

Expected Operations:

  • Query context item to gather assignment decision data
  • Query existing Activity Assignment items if needed
  • Modify Activity Assignment items with appropriate properties
  • Return success result or error

Permissions:

  • Method must have appropriate execution permissions

Code Structure

Basic structure for a Workflow Assignment Rule method:

// 1. Get Innovator context
Innovator inn = this.getInnovator();

// 2. Resolve context item
string contextTypeId = this.getAttribute(“context_type_id”);
string contextItemId = this.getAttribute(“context_item_id”);

// Validate context
if (string.IsNullOrEmpty(contextTypeId) || string.IsNullOrEmpty(contextItemId))
{
return inn.newError(“Unable to determine context item”);
}

// 3. Load context item
Item contextItem = inn.newItem();
contextItem.setAction(“get”);
contextItem.setAttribute(“typeId”, contextTypeId);
contextItem.setID(contextItemId);
contextItem.setAttribute(“select”, “properties_you_need”);
contextItem = contextItem.apply();

if (contextItem.isError())
{
return inn.newError(“Failed to load context item”);
}

// 4. Apply business logic to determine assignees
// ... your custom logic here ...

// 5. Modify activity assignments
Item assignment = inn.newItem(“Activity Assignment”, “add”);
assignment.setProperty(“source_id”, activityId);
assignment.setProperty(“related_id”, assigneeIdentityId);
assignment.setProperty(“voting_weight”, “100");
assignment = assignment.apply();

if (assignment.isError())
{
return inn.newError(“Error creating assignment: " + assignment.getErrorDetail());
}

// 6. Return success
return this; // Or return inn.newResult(“Success message”)