This topic describes how to set up Salesforce synchronization in your Agiloft knowledgebase.
To view a video tutorial on Salesforce syncing, click here.
- Create a Salesforce developer account.
- Have a test email account ready to use as a login and to receive notifications.
- Obtain your Salesforce security token. See: https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm
- Ensure that all fields which should be synced with Salesforce have been added to the knowledgebase.
Follow these steps
- In your Agiloft knowledgebase, select Setup > Sync > New > External Sync.
- On the General tab:
- Set External System Type to Salesforce.
Set up Directions and Conflicts according to your system requirements.
On the ESA Settings tab:
For the Salesforce WSDL endpoint, enter https://login.salesforce.com/services/Soap/u/33.0.
Note: This value will be updated from time to time by Salesforce. See the SOAP API Developer Guide for documentation on generating or obtaining the Web Service WSDL.
Enter your Salesforce account email login.
In the Password field, use the following format: <SALESFORCEPASSWORD+SECURITYTOKEN>. For example, SfP@s5wrdSECURITYTOKEN.
On the Mapping tab, map the objects in the Agiloft KB with the external Salesforce system. All Salesforce tables are supported in Agiloft, including both standard tables and custom tables and their relationships. To map an object:
Locate the Agiloft table in the list and then select the corresponding Salesforce table from the drop-down menu.
Click Map to open the Field Mapping wizard.
Select a field to use to identify the timestamp for when the records were modified.
- Choose whether to synchronize records based on timestamps, or to simply import or export records.
- Choose the operations you want to allow during the sync, from both sides of the sync.
- Determine how the record ID is generated during the sync. This can be done by Salesforce or in Agiloft, in which case you must also specify a prefix and a table column in which to store the generated IDs.
- For each external field, select the corresponding
Agiloft field and select the Update check boxes to determine which records are updated. For fields with multiple choice values, complete the dialog box that opens for you to map individual choice fields.
Select the Identifying column for the fields you want to use to match records between the systems. If you want to match records only when all the Identifying fields match, select the "Use strict match for identification" check box; otherwise, the system will try to identify matches by all fields, then narrow it down until it can match by any field.
In the Filters tab you can use saved searches as filters for synchronized fields.
On the Relation Mapping tab, set any linked field relations with mapped fields.
Fields from key linked sets in the Relation Mapping tab cannot be used in the Mapping tab as these will define primary relationships between the key tables. For example, Phone Number or Email fields in the Company mapping are part of the linked set between Company and Contact, and will make it impossible to set up a relationships between Company and Contact in the Relation Mapping tab.
Click Next, then Finish. This will create an entity set using the sync name, which will allow you to transfer your sync to another KB.
- It is highly recommended for all tables which have strict links for fields which are going to be synced, to select the 'Allow entries not in source table' option in the Mapping tab of the Linked Fields wizard.
Otherwise, the sync won't be able to save values from SF which aren't represented in the linked AL source. The same is for the unique attribute. For the Demo KB such modifications are:
- Lead table - compound field Company / Location Name should be not unique.
- Company and Person table - Linked Field to Locations should be set Loose, otherwise records with addresses not represented in the Locations table will fail on creation.
It is mandatory to match the required level of linked fields between Agiloft and Salesforce for the tables you are setting up to sync.
In Salesforce the Contract to Account relationship is mandatory, whereas in Agiloft it is a Contract to Company relationship and not required. In this case we need to set the Company linked field as Required. Navigate to Setup > Contract > Company linked field > Edit > Options Tab > Require the user to choose record(s) to be imported? > Yes > Finish.
- You can run the sync manually in a table's Action Bar by selecting Actions > Sync > Run <Salesforce account name>.
You can use a time-based rule to setup an automated sync process.
- Navigate to Setup > Sync / Edit the Salesforce configuration > Next > Next > Running tab > Select the 'By Actions (Rules/Workflow)' option > Finish.
- Navigate to Setup > Rules > New.
- In the Rule wizard, in the...
- General tab, enter a name and select a table.
- Rule Type tab, select At selected time intervals.
- Condition tab, select Run once per scheduled time interval.
- Schedule tab, set Apply Rule = <as necessary>.
- Action tab, click the Create Sync Action button.
- In the Sync Action wizard:
- Enter an action name.
- Select your configuration by performing a lookup for the External System ID control.
- Click Finish.
- Click Finish.
After that, the sync process will run based on the interval set on the Schedule tab.
The sync will operate for all tables mapped in the sync configuration, regardless of which table contains the rule. If you need to sync some tables separately, you will need to create a separate Salesforce ESA configuration for each table and use them in different sync actions. You should be careful with multiple Salesforce syncs that you do not create conflicts with existing mappings.
If you intend to synchronize attached file fields with Salesforce and ensure that changes are automatically reflected in Agiloft, you will need to add some code in the Salesforce developer account to act as a trigger. This will automatically update the last modified field of the parent record whenever the attached file is changed in the Salesforce account, which prevents the user from explicitly editing and saving the record after changing the attachment file.
The sync will create a new version of the file field whenever a change is made. Therefore, in the File with Versioning field setup, you should set "Enable Versioning" to Yes in the Options tab, or changes from Salesforce to Agiloft will only reflect the first time after sync. The Salesforce field "Attachment" can be used for the sync setup.
- In the home page of the Salesforce Developer Console, click File > New > Apex Trigger.
- Add a name - such as AttachmentTrigger - and select sObject = Attachment, and click Submit to save it.
In the console, enter the following code logic, customizing it to use your set of synchronized tables:
- Save the trigger.