How to update a parameter value in AP using an activity.
How to update a parameter value in AP using an activity.
Updating a parameter value using an activity is useful when more information becomes available during the execution of a workflow.
Example:
A service is ordered where action is taken in an external system, and an ID is created e.g. a ticket number is created. This ticket ID can be fed back as a parameter and automatically update all activities requiring the information in the workflow. All activities continue to run and can reference this parameter and use the value until the workflow is complete.
The Process:
- Create an activity createticket ticket with a parameter TicketID.
- Create an activity sendemail with parameters: MailFrom, MailTo and TicketID
- Connect the two activities in a workflow eg. Createticket and sendemail.
- Create a service with that workflow. eg. Createticket and sendemail.
- Configure the TicketID parameter on the sendmail activity on the service level
- make it invisible on checkout.
- set the value population to reference the value of the TicketID from the Createticket activity.
The result:
- During checkout, the TicketID parameter (from the createticket activity is empty.
- Once the workflow has run, the TicketID parameter receives a value
- The sendemail activity has resolved to the value created in the createticket activty. (from the reference made in configuration on service level)
Create the Activities
Create the following PowerShell scripts:
createticket activity
Param(
$TicketID
)
$TicketID = CreateNewTicket
sendemail activity
Param(
$MailTo,
$MailFrom,
$TicketID
)
Send-MailMessage -Subject "Your TicketID is $TicketID"
- Select Activity Admin from Administrator menu.
- Select Add Activity.
- Browse and upload createticket.ps1.
- Save changes.
- Repeat for sendemail.ps1 activity.
The activities has been created and added to the Activity Admin page.
Create the Workflow
Create a workflow that connects the two activities createticket and sendmail.
- Select Workflow Admin from the Administer menu.
- Select Add workflow.
- Fill in the details needed for the workflow.
- Name: Create ticket and send email.
- Type: Order
- Select Add Workflow
- Drag the activity createticket and sendmail from the Activity Library to the workflow space. The createticketactivity must be in the first position in the workflow
- Press Save.
Create the Service
Create and configure the service.
- Select Service Admin from the Administer menu.
- Select Add service.
- Complete the information in the dialog box.
- Name: Create ticket and send mail.
- Order workflow: Select Create ticket and send mail from the drop down selection
- Select Add Service. The Servie has now been added to the Service Admin page.
- Select View on the service to open up the attached workflow.
- Select View on the sendmail activity to open the configuration.
- Select View on the TicketID parameter.
- On the Value Population tab, deselect the parameter visability so it will not be shown on checkout.
- Set the value populationwith a reference to the value TicketID in the createticket.ps1 activity.
- Select Add reference
- Filter and select the reference
- Select Add reference
- Select Save All.
Run the Service
When the service is ordered, the TicketID (originating from the Createticket.ps1 activity) is empty.
Request Monitor
When the workflow has run, check the logs in the Request Monitor
- Select Request Monitor from the Adminsiter menu.
- Select the Service Create ticket and send email.
- Select the activity createticket.ps1. TheTicketID parameter is given a value.
- Select the sendemailactivity. In the TicketID parameter, the reference to the createticket from the sendemail activity has resolved to the value returned in the createticket activity.