Creating a Script Custom Activity
You can create an activity based on a user-defined script. The following procedure creates an activity that changes a decimal value to a percentage value, for example, 0.7 is converted to 70%.
- From your Workflow window in the Activities pane, click Create Activity.
- In the New Activity Type dialog box, from the Activity Type list, select Script, and then click OK.
- In the New Script Activity dialog box, click the General tab and provide the following general details:
- For the Name property, enter the name of the activity, for example, PercentageToValue. This is the name you see in the Activities pane.
- For the Description property, specify what the activity does.
- For the Group property, select the activity group where you want to place the new activity, for example, Utilities. If you do not select a group, the new activity is placed in the Ungrouped group.
- Click the Inputs tab to define the input variables for the activity.
In our example, the PercentageToValue activity needs a variable to store the percentage value:
- Click Add.
- In the Add new property dialog box, enter the name of the variable in the Variable Name box, for example, percentageValue.
- Select float from the Variable Type list, and then click OK.
You can specify default values for the new input in the Value column.
Following our example, the PercentageToValue activity will need code to return the percentage from the given float value, as shown below:
return (activity.getInput("percentageValue")*100) + "%";
Also, specify the activity output in the Output Variable box and select the output type from the Output Type list.
- Click OK.
The new activity is listed in the Activities pane under a specific activity group. You can drag the activity to the design area to start using it in your Workflow.
Last modified: 6/8/2018 8:43:44 PM