Divstyle | |||||||
---|---|---|---|---|---|---|---|
| wiki
| spaces/E2D/pages/29982926 / Workflow Studio / Workflow Studio / Using Workflow Components / Adding Activities to Workflows / Current: Adding Operations to Multi-Operation Activities
| |||||
The Multi-Operation activities that ship with Workflow Studio can be extended to support your own custom operations. In this topic we demonstrate this by adding a new operation called "EditNameAttributes" to the Person Multi-Operation activity we created in the the Creating Operation Activities topic.
To add Operations to Multi-Operation Activities
- Open the Multi-Operation Operation Activity to which you want to add an Operation. In our example, we using the Operation activity we created in the Creating Operation Activities topic.
- With the Multi-Operation Operation activity open in the Activity Designer, right-click on the activity and select Add New Operation from the context menu.
- In the Add New Operation window that appears, enter a name for the operation in the Operation Name field and a friendly or display name in the Friendly Name field and then OK to close the window.
- Right-click on the activity again and select Edit Operation Executor > Edit EditNameAttributes Executor from the context menu. This
...
- allows you to define what occurs when the operation is executed against the Person object.
Type the desired code for the operation executor in the C# Editor that opens. In our example, we have added code to set the FirstName, LastName, and MiddleName attributes to that entered into the workflow form.
Code Block language c#
...
...
/Set the Person against whom the Operation is being executed to the workflow's target resource C.Person person = CurrentWorkflow.TargetResource.Person; //Set the first name to the approval form's TargetPerson.FirstName property person.FirstName = CurrentWorkflow.Form_TargetPerson.FirstName; //Set the last name to the approval form's TargetPerson.FirstName property person.LastName = CurrentWorkflow.Form_TargetPerson.LastName; //Set the middle name to the approval form's TargetPerson.FirstName property person.MiddleName = CurrentWorkflow.Form_TargetPerson.MiddleName;
Next, enter the following code to create an instance of the OperationExecutionSummary to return the results of the operation to the workflow user.
Code Block language c#
...
OperationExecutionSummary opExecutionSummary = (OperationExecutionSummary) Parameters[person.ResourceID.ToString()]; opExecutionSummary.OperationExecuted = person.Update(); CurrentWorkflow.OperationExecuted = CurrentWorkflow.OperationExecuted || opExecutionSummary.OperationExecuted; Parameters[person.ResourceID.ToString()] = opExecutionSummary;
The following image shows what the code looks like in the C# Editor.
Info |
---|
To have your changes take effect in EmpowerID, be sure to compile and publish any new or edited Operation activities. |