PlatformApplicable to all products in Temenos Journey Manager. | All Personas | All versions This feature is related to all versions.
You can configure a delivery processing function against a particular Manager form in Salesforce, so that you can update your standard and custom Salesforce objects with data from the submitted form. The consideration as to which object to create or update in Salesforce is typically unique to the use case being targeted but often this involves the Contact or Lead objects.
For more information on the Salesforce standard objects, see Salesforce sales objects
TransactDeliveryProcessor
, which allows you to provide JSON configuration to control what objects are affected by the submission and how.Delivery Trigger Types
Delivery records are received from Manager according to the specified triggers. Transactions are typically delivered when completed, but they can also be delivered when the transaction has been saved or deemed to be abandoned, to facilitate lead generation and follow up.
Managing Form Versions
Where you need to perform different delivery processing functions between multiple versions of a form you may append an array of versions to the form code attribute to target specific versions. For example, you may wish to have 2 separate delivery processing functions, one for the first version of the form and another for subsequent versions. This will allow you to continue to accept deliveries for in-flight transactions on old form versions after a new version is activated.
To utilize this feature you must specify the specific version numbers as an array directly after the form code. Some samples assuming a form code of 'my-form':
The TransactPrefillGenerator class uses the following JSON configuration:
{
"parameters":{
"<param-name>": "<param-value>"
},
"sobjects":{
"<object-label>": {
"type": "<object-api-name>",
"matchFields": ["<field-name>", ... ],
"insertFields": ["<field-name>", ... ],
"updateFields": ["<field-name>", ... ],
"sourceFields": {
"<field-name>": "<field-mapping>",
...
},
"relations": {
"<relationship-name>": "<object-label>",
...
}
},
...
}
}
The following example configuration illustrates all supported directives:
{
"parameters": {
"formAssociationTarget":"new-case",
"attachmentTarget":"new-case",
"receiptTarget":"new-case",
"caseNumber":"new-case.CaseNumber"
},
"sobjects": {
"parent-account": {
"type": "Account",
"insertFields":[],
"updateFields":[],
"sourceFields" : {
"Id":"[!XML://Account/AccountId]"
}
},
"my-contact": {
"type": "Contact",
"matchFields":["LastName","Email"],
"insertFields":["*"],
"updateFields":["Email","Phone","MobilePhone","Title","Department"],
"sourceFields" : {
"Id":"[!XML://Contact/ContactId]",
"Salutation":"[!XML://Contact/Title]",
"FirstName":"[!XML://Contact/FirstName]",
"LastName":"[!XML://Contact/LastName]",
"Phone":"[!XML://Contact/Phone]",
"MobilePhone":"[!XML://Contact/Mobile]",
"Email":"[!XML://Contact/Email]",
"Title":"[!XML://Contact/Position]",
"Department":"[!XML://Contact/Department]"
},
"relations": {
"Account": "parent-account"
}
},
"new-case": {
"type": "Case",
"insertFields":["*"],
"updateFields":["*"],
"sourceFields" : {
"Type":"[!XML://IssueDetails/IssueType]",
"Reason":"[!XML://IssueDetails/Reason]",
"Subject":"[!XML://IssueDetails/Summary]",
"Description":"[!XML://IssueDetails/Description]",
"Origin":"Web"
},
"relations": {
"Account": "parent-account",
"Contact": "my-contact"
}
}
}
}
The list of supported parameters is shown below:
A single JSON configuration can define impacts to any number of Salesforce objects. Each object configuration must be given a label that is unique in the configuration. Note the configuration below for a Contact object:
"my-contact": {
"type": "Contact",
"matchFields":["LastName","Email"],
"insertFields":["*"],
"updateFields":["Email","Phone","MobilePhone","Title","Department"],
"sourceFields" : {
"Id":"[!XML://Contact/ContactId]",
"Salutation":"[!XML://Contact/Title]",
"FirstName":"[!XML://Contact/FirstName]",
"LastName":"[!XML://Contact/LastName]",
"Phone":"[!XML://Contact/Phone]",
"MobilePhone":"[!XML://Contact/Mobile]",
"Email":"[!XML://Contact/Email]",
"Title":"[!XML://Contact/Position]",
"Department":"[!XML://Contact/Department]"
},
"relations": {
"Account": "parent-account"
}
}
The Transact for Salesforce App version 1.5. The matchFields directive provides a basic de-duplication function by first searching for a matching record before determining whether to perform an insert or update. To utilize this optional function, provide an array of Salesforce field names that should be used to identify an existing record. If a record is found in Salesforce where ALL the listed fields are an exact match for the information provided in the form, this record will be updated.
For example, the following directive will cause the delivery processor to search for a Contact object with matching LastName and Email:
"my-contact": {
"type": "Contact",
"matchFields":["LastName","Email"],
...
The insertFields directive is required for all object definitions and allows you to explicitly define which fields will be used in an insert scenario (when an Id value is not available).
The updateFields directive is required for all object definitions and allows you to explicitly define which fields will be used in an update scenario (when an Id value is available).
The sourcefields directive is required for all object definitions and allows you to define the mappings from the submitted XML data into the object fields.
"sourceFields" : {
"Id":"[!XML://Contact/ContactId]",
"Salutation":"[!XML://Contact/Title]",
"FirstName":"[!XML://Contact/FirstName]",
"LastName":"[!XML://Contact/LastName]",
....
}
"Origin":"Web"
[!XML://<xml location>]
where <xml location> is the URI to the XML element containing the required value. Note the root XML node is not specified in the location.
If your data contains repeating nodes than you may target a specific node index to pull data from a specific node by specifying the node index (starting at zero) in parentheses. For example the following mapping will pull the Email data element from the 2nd Applicant node in the XML:[!XML://Applicants/Applicant(1)/Email]
[!LOOKUP://<object-name>?<field-name>=<field-value>[&<field-name>=<field-value>]
For example, the following lookup function will search for a Contact record with matching first name and last name and insert the resulting record Id into the Contact__c lookup field: "Contact__c":"[!LOOKUP://Contact?FirstName=[!XML://Contact/FirstName]&LastName=[!XML://Contact/LastName]]"
The value will be left empty if no matching record is found. If multiple records are found, an exception will result.
The relations directive is optional and allows you to specify object relationships to other objects defined in the configuration.
"relations": {
"Account": "parent-account",
"Contact": "my-contact"
}
For each relationship specified, the key value should match the name of a relationship against the object and the reference value should match an object label of the correct type specified in the configuration.
The example configuration above will consume the following XML submission data structure to create the new Case object and make updates to the contact information for the Contact:
<?xml version="1.0" encoding="UTF-8"?>
<AvokaSmartForm>
<Account>
<AccountId>00128000002gH6DAAU</AccountId>
<AccountName>Big Top Enterprises</AccountName>
<Industry>Entertainment</Industry>
<Website>www.bigtop.com</Website>
<AccountRep>Ben Warner</AccountRep>
</Account>
<Contact>
<ContactId>00328000001tCzaAAE</ContactId>
<Title>Mr.</Title>
<FirstName>Jolly</FirstName>
<LastName>Roger</LastName>
<Position>CEO</Position>
<Department>Management</Department>
<Phone>+61 2 9955 6600</Phone>
<Mobile>0411 803 240</Mobile>
<Email>[email protected]</Email>
</Contact>
<IssueDetails>
<IssueType>Problem</IssueType>
<Reason>Instructions not clear</Reason>
<Summary>Can't find where screw C3 goes</Summary>
<Description>It is holding together but for how long?</Description>
</IssueDetails>
</AvokaSmartForm>
Where the default delivery processor does not provide the level of control required, you may define your own delivery processor by developing an APEX class that implements the ITransactDeliveryProcessor interface. To utilize your custom delivery processor, simply specify the class name in the relevant Delivery Processor record and any configuration required by the class.
global interface ITransactDeliveryProcessor {
/**
* This function processes the delivery record based on the config provided.
*
* @param delivery The Transact Delivery object to be processed
* @param processorConfig The string containing the processing config
*/
void processDelivery(Transact_Delivery__c delivery, String config);
}
The following custom delivery processor class is configured to send an email to an inbox when the submission is delivered to Salesforce.
global class CustomDeliveryProcessor implements avoka.ITransactDeliveryProcessor {
public void processDelivery(avoka__Transact_Delivery__c delivery, String processorConfig){
System.debug('Custom Delivery Processor: ' + delivery.Name);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'[email protected]'};
mail.setToAddresses(toAddresses);
mail.setSubject('Custom Delivery Processor: ' + delivery.Name);
mail.setPlainTextBody('Processing complete: ' + delivery.Name);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
To configure your custom delivery processor to be used you must enter the class name in the Delivery Processor object with the appropriate form code. The default value is 'TransactDeliveryProcessor' - you can modify this to be your own class name and it will be used instead of the default. You can also specify your own configuration data if required - your processor class will receive this configuration in the 'config' string parameter in the processDelivery() method signature.
If you have any trouble getting your custom delivery processor class to be used, use the global
keyword in the class declaration to ensure it is visible to the package.
Next, learn how to configure Manager to support the Transact for Salesforce App.