How To Create Workflow Actions

Overview

Workflow Actions are activities that are done whenever a workflow rule is evaluated to true. Actions are the children of workflows and thus a workflow must be created first before creating workflow actions.

Procedures

1. Select the appropriate workflow that the action will be associated with.

Navigate to Setup > Develop > Workflows, then select an existing workflow. If no workflows exist, refer to How To Create Workflows to create a new one.

After selecting a workflow, the workflow details page is displayed.

2. Create the workflow action.

Click the Workflow Action node on the left navigation pane. This will display the list of available actions of the workflow. If there is only one action available, the details page will be automatically displayed.

Click New to create a new action or select an existing action to view its details or update them.

The details page is displayed and the parameters of the action can now be defined.

Field Definitions

Table 1
Field Definition
Name Unique name of the action. Note that the uniques is global so the same name cannot be used between two different workflows.
Description A descriptive summary of what the workflow does.
Status The status of the workflow. When ACTIVE, the workflow action is executed. When DEACTIVATED, the workflow action is skipped. This field can be updated after the creation of the workflow action as needed.
Action Type

Specifies the type of action that will be performed by the action. Available options are:

  • Record Create - Creates a record in a target Entity.
  • Record Upsert - Upserts a record in a target Entity. If a record using the Upsert Field value exists, it will update that record. Otherwise, a new record is created.
  • Field Update - Updates the value of a field.
  • Email - Sends an e-mail using an existing e-mail template in the system.
  • HTTP CallOut - Sends a web call-out to a remote web service via HTTP. Note that knowledge of HTTP callouts such as POST, GET, etc. is needed in order to effectively use this feature.
Field To Update

Applicable only when the Action Type is set to Field Update. This is the field on the entity record or reference record field up the hierarchy or child nodes that needs to be updated. The Insert Field can be used for easy navigation into the parent, reference, or child node hierarchy and selection of a field.

Update to Null

Applicable only when the Action Type is set to Field Update. When checked, this updates the field specified by Field To Update to null/blank.

Field Update Formula

Applicable only when the Action Type is set to Field Update. Text area where the new value of the field to be updated can be written. This can be a constant or a complicated formula that can pull values from other fields and concatenated with others or built-in functions. The following buttons can be used to aid in the authoring of the formula:

Button Definition
Insert Field Brings up a pop-up where the fields that are available for referencing based on the hierarchy of the entity are listed. Selecting from the list will automatically add the field to the end of the formula. Copy and pasting may need to be done to position the field in the formula.
Insert Operator Brings up the comparison operators that are available for use. Copy and pasting may need to be done to position the operator in the formula as this will be added at the end of the formula by default.
Insert Function

Brings up the list of functions that are available for use. These functions range from system values such as the system date/time, date/time manipulation, down to string manipulation such as substr() and upper(). Copy and pasting may need to be done to position the operator in the formula as this will be added at the end of the formula by default.

Refer to the description and syntax on the pop-up on what each function does.

Attach File Applicable only when the Action Type is set to Email. When a DOCUMENT-type field is present in the record, this file is attached to the e-mail.
Email Template

Applicable only when the Action Type is set to Email. This brings up the list of e-mail templates that are available for use against the entity that the workflow is associated with. If there are no templates available, a new one must be created.

Refer to the How To Create An E-mail Template section for more details.

Recipient To Applicable only when the Action Type is set to Email. This specifies the main recipient of the e-mail that will be sent by the action. This overrides the e-mail template's definition for this field.
Recipient CC Applicable only when the Action Type is set to Email. This specifies the CC recipient of the e-mail that will be sent by the action. This overrides the e-mail template's definition for this field.
Recipient BCC Applicable only when the Action Type is set to Email.  This specifies the BCC recipient of the e-mail that will be sent by the action. This overrides the e-mail template's definition for this field.
Callout URL Applicable only when the Action Type is set to HTTP CallOut. The URL where the message will be sent. For example: https://www.google.com.ph/
Message Body

Applicable only when the Action Type is set to HTTP CallOut. The actual message body. Field references can be used to populate the message. A sample message can be:

?gfe_rd=cr&ei={!AccountObj.Name}-IDIAw&gws_rd=ssl#q={!Entity.Field1}+search+example

 

{!XXXXX.XXXX} are fields that can be referenced in the workflow action. The rest are normal strings.

HTTP Header Values Applicable only when the Action Type is set to HTTP CallOut. This allows the definition of HTTP headers for the callout.
HTTP Method

Applicable only when the Action Type is set to HTTP CallOut. This specifies the type of HTTP CallOut to be made. Available options are:

  • GET
  • POST
  • PUT
  • DELETE
Entity for Create Applicable only when the Action Type is set to Record Create. This specifies the target entity where the new record will be created.
Upsert Field Applicable only when the Action Type is set to Record Upsert. This specifies the unique key field of the target entity that will be used to check whether the record being upserted will be created or updated.
JSON Entity Representation

Applicable only when the Action Type is set to Record Create. This is auto-populated by a JSON request containing the fields of the target entity selected in the Entity for Create field. The Insert Field button can be used to source the data from entity fields via the object reference model. The value section will have INSERT DATA where you can enter hard-coded data or replace with a field.

[{
		"RTP_WORKFLOW_TEST_CHILD_ENTITY" : {
			"Rtp_Workflow_Test_EntityId" : "INSERT DATA",
			"ChildEntityText" : "INSERT DATA",
			"SomeCheckbox" : "INSERT DATA"
		}
	}
]

BillingPlatform formula language can be used to build the data that will be used to populate the fields of the record that will be created. For example, the formula below creates a record in the RTP_WORKFLOW_TEST_CHILD_ENTITY entity with the ChildEntityText field being a concatenation between the TextField1 content of the current entity, a space, and then a date:

[{
		"RTP_WORKFLOW_TEST_CHILD_ENTITY" : {
			"Rtp_Workflow_Test_EntityId" : "{!Rtp_Workflow_Test_EntityObj.Id}",
			"ChildEntityText" : {!{!Rtp_Workflow_Test_EntityObj.TextField1} || ' ' || to_date('20160504', 'yyyymmdd')},
			"SomeCheckbox" : "1"
		}
	}
]
Order of Execution  An integer field that allows you to specify the order by which the action is performed. This is used when there are more than one action associated with the entity. If there are more than one action with the same order value, the actions are executed according to the Name value in ascending alphabetical order.
Action Filter This allows you to limit or provide conditions on when the action is performed. This is specially useful when dealing with actions that impact records/fields/objects in the child nodes relative to the workflow entity. The standard object reference model table or formula can be used to build the filters.

Other Considerations

Emails

The e-mail body cannot be overridden in the workflow action. The field references in the e-mail body needs to be modified on the e-mail template directly.

Processing HTTP Callout Return Messages

When an HTTP callout action is executed and the remote server returns XML data, this can be processed by a series of succeeding workflow actions (e.g. Field Update-type, etc.) using the XPath notation. In order to do this, the GetXmlValue() is used. This function takes only one parameter: an XPath expression that conforms to XPath 1.0 standard.

The function is unable to process namespaces right now so the following syntax will need to be used to access/find the tags in the XML message:

*[local-name()="mytag"]

Note that the HTTP callout action must be invoked before the actions that will consume the XML response. This can be controlled using the Order of Execution field. The XML response data will then be discarded after all workflow actions associated with the workflow are completed.

Example: Say that an HTTP GET callout workflow action is invoked to retrieve data from a remote server, and the response is stored in an XML payload. The next workflow action can be a field update that will have the following formula:

{!AccountObj.Id} || ' ' || GetXmlValue('//*[local-name()="email"]/text()')

This will store the Id field of the Account record in the context of the workflow and will be concatenated with a space along with the data in the email XML tag of the HTTP callout response.

3. Save the changes.

Click Submit to save the changes to the workflow action.

 

Related Topics

Have more questions? Submit a request

Comments

Powered by Zendesk