Updating Fields Programmatically
After a OneSpan Sign Convention has been created, users who create transactions manually can use the Convention to automate certain tasks. Instead of having to perform those tasks manually, having them performed automatically saves users time.
Specifically, users can run programs to automatically:
- Position OneSpan Sign fields in multiple documents for multiple recipients via Text Tags
- Update OneSpan Sign fields with Salesforce data via Field Mappings (the Insert feature)
- Update Salesforce fields with OneSpan Sign data via Field Mappings (the Writeback feature)
The following sections describe how to do these things:
Updating OneSpan Sign Fields
The Insert feature copies a value of a Salesforce field (e.g., First Name) into a corresponding field of a OneSpan Sign document when a transaction is being prepared. That data can then be retrieved from the signed document. The data in question can be either data about a recipient, or data about a Salesforce related object.
To use a program to automatically insert data from the Salesforce database into an input field in a OneSpan Sign document:
- Write code that will: (a) create the transaction; (b) attach to the transaction a suitable Convention, suitable documents, suitable recipients, etc.
- Add to that code the following URL parameter: "
Insert=1
" OR "Insert=true
". Your code should resemble the following example:
If your Convention contains Text Tags, fields will automatically be created and positioned inside OneSpan Sign documents.
/apex/esl__package?ParentId={!Account.Id}&Name={!Account.Name}%20Agreement& Documents=00P36000000wwrd&ConventionId=a0836000000nfRo& Signer1=00336000003gBYX&Signer1Label=a0K36000001j8V&Insert=1
Here:
Signer1Label
is the SalesforceId of the Recipient Label to be applied toSigner1.
- The
ConventionId
is the SalesforceId of the Convention to be used.
- Create a Custom Button that will run that code. Once that button is clicked, you should see all inserted Salesforce data in the created transaction.
Updating Salesforce Fields (Writeback)
A Field Mapping's Writeback feature can automatically update data in Salesforce fields from OneSpan Sign documents.
For example, suppose that: (1) a recipient notices during the Signer Experience that his address is wrong in a OneSpan Sign transaction document; (2) the recipient corrects his address in that document.
If that OneSpan Sign address is mapped to a field of a Salesforce related object, and the Writeback option has been checked for that mapping, when the OneSpan Sign transaction is complete, the updated address will be written into the Salesforce field.
The data to be written back into Salesforce must be entered during the Signer Experience.
To use a program to update a Salesforce field with data from a OneSpan Sign document when the associated transaction is completed:
- Write code that will: (a) create the transaction; (b) attach to the transaction a suitable Convention, suitable documents, suitable recipients, etc.
- Add to that code the following URL parameter: "Writeback=1" OR "Writeback=true". Your code should resemble the following example:
If your Convention contains Text Tags, fields will automatically be created and positioned inside OneSpan Sign documents.
/apex/esl__package?ParentId={!Account.Id}&Name={!Account.Name}%20Agreement&
Documents=00P36000000wwrd&ConventionId=a0836000000nfRo&
Signer1=00336000003gBYX&Signer1Label=a0K36000001j8V&Writeback=1
Here:
Signer1Label
is the SalesforceID of the Recipient Label to be applied toSigner1.
- The
ConventionId
is the SalesforceID of the Convention to be used.
- Create a Custom Button that will run that code. Once that button is clicked, after the OneSpan Sign transaction is complete, the data updated during the Signer Experience should appear in the associated Salesforce field.