Techniques for specifying data to be passed to a target application or API
When you add an action to your flow, you need to specify data for any required target fields for the action (or invoked API operation) to be performed. You can also specify data for any optional fields for the action. For example, if you add a Send email action for Gmail, an email address for the recipient is required, whereas a subject for the email is deemed optional.
In each required field for the target application, ensure that you provide a value as needed by the target application. If you map the name of a source field, you should ensure that the source application will pass a suitable value; otherwise, if a value passed is invalid the flow can't complete successfully. In your flow, you can use conditional logic to do something appropriate if a value passed is invalid.
- Passing field values from the source application or other preceding target applications
- Passing array values and transforming to other formats
- Passing a response code from a previous action
- Applying functions to process data passed to a target application
- Filtering fields by using a free text search
Passing field values from the source application or other preceding target applications
In each target field, you can add a reference to source fields to have the value of those fields passed to a target application. The following example adds Jane Doe@email.com to the required target field 'Email Address' if the value of the source field 'Email' is Jane Doe@email.com (the source application must pass such a valid email address).
To add a reference to a source field, click in the target field to reveal the Insert a reference icon next to the field.
- If you start typing the name of a source field (like
email
) and then pause briefly, App Connect offers you choices for fields based on what you are typing. Alternatively, you can click the Insert a mapping icon to see the full choice of fields that you can insert. - You can select fields from the event or from previous target applications in the flow. For example:
Passing array values and transforming to other formats
Sometimes you might want to pass an array of items to a target application and select values from
the array. You can apply functions to process the array to your requirements. For example, if you
selected a source field that passes an array of Salesforce accounts, you might see a message like:
Warning: Contains an array that will be converted to a
string with a link that says How can I resolve this? If you select a source
field that passes an array value, you can choose to pass the value of the first instance in the
array, join all instances, pass the array without doing anything, or edit the source field as a
JSONata expression. You might apply a JSONata function to select the first account from the array
and select that account's ID field. When you
edit JSONata functions, they are displayed as an expression like
{{$SalesforceRetrieveAccount[0].Id}}
. When finished, the expression is displayed as
a source field name with the JSONata symbol (J:).
You can select the source field name to do more, such as to edit the expression or apply more functions. (For information about applying functions, see Applying JSONata functions to transform your data.)
Passing a response code from a previous action
A target application can also use the response code from a previous action. In the following example, an If node follows a Salesforce update or create action to provide conditional processing depending on whether the Salesforce record was updated or created. You can use the status code in the If node to perform different actions for existing or new records. For more information about this example, see the tutorial Creating an event-driven flow that updates or creates a contact in Salesforce and updates Asana whenever you receive a form in Wufoo
Applying functions to process data passed to a target application
You can apply functions to the source fields. You can also type text in the target fields.
- To add source field names, click in the target field and then either:
- Type part of a source field name, and then select a source field from the list offered.
- Select source field names from the (+) menu.
- To use a transform function to customize the value of a source field, select the field name and then select Apply a function; select a function from the list provided.
Filtering fields by using a free text search
When adding or editing actions in the flow editor, you can quickly locate any fields that you want to complete by using the filter bar to perform a free text search. The filter bar is displayed when an action shows 10 or more fields in the default view or in advanced mode, and is retained if you subsequently switch to preview mode after mapping some fields.
To apply a filter, simply begin to type a sequence of characters that are included in the field
names that you want to search for. The search is case insensitive and can also include characters
like a space or hyphen (-). For example, you can type id
to search for all fields
with id, iD, ID, or Id in the field name, or type r i
to search for a field name
like Owner ID, or type y-
to search for a field name like Stay-in-touch
email subject. Field hierarchies are also typically maintained – so a matching parent field will
show nested child fields, and a matching child field will show its parent field.