Page tree
Skip to end of metadata
Go to start of metadata

Salesforce Integration

This topic describes how to set up Salesforce synchronization in your Agiloft knowledgebase.

To view a video tutorial on Salesforce syncing, click here.
 

Prerequisites

Follow these steps

  1. In your Agiloft knowledgebase, select Setup > Sync > New > External Sync.
  2. In the External Sync window
    1. Set External System Type to Salesforce.
    2. Set up Directions and Conflicts according to your system requirements.

    3. Click Next.

  3. In the ESA Settings tab...

    1. 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.

    2. Enter your Salesforce account email login.

    3. In the Password field, use the following format: <SALESFORCEPASSWORD+SECURITYTOKEN>. For example, SfP@s5w[]rdSECURITYTOKEN.

    4. Click Next.

  4. In the Mapping tab, the objects in the Agiloft KB can be mapped with the external SalesForce system.

    1. Currently all standard Salesforce tables flagged as Creatable are supported in Agiloft.

    2. The complete list of supported tables can be seen here.

    3. Some examples of mapping between Agiloft and Salesforce are:

      1. Agiloft Company = SF Account

      2. Agiloft Lead = SF Lead

      3. Agiloft Person = SF Contact

      4. Agiloft Opportunity = SF Opportunity

      5. Agiloft SupportCase = SF Case.

    4. Select a Salesforce entity next to a table and click Map to open the Field Mapping wizard.

    5. Create all of the field mappings between the Agiloft tables and Salesforce: 

      1. Select a field to identify the time at which the records are modified.

      2. Select whether records are synchronized based on timestamps, or simply exported/imported in the update.
      3. Select the permissible operations that can be performed during the sync, on the side of both  Agiloft and the Salesforce external system. 
      4. Select how the record ID should be generated during sync. This can be done by either the external system or in Agiloft, in which case a prefix should be specified and a table column should be selected in which to store the generated IDs. 
      5. When a multiple choice value is selected for mapping, a dialog box opens below where you can map the individual choice fields. This enables you to define the choice lists when the Salesforce and  Agiloft options are different in number and type.
      6. The Identifying column defines the fields that are used to establish the initial relationship of records which are not in sync yet by matching them in both systems. If you select the option "Use strict match for identification", the system will only synchronize if all Identifying fields are found to match; otherwise, it will try to identify by all fields, then narrow down until it can match by any field.
      7. For an instructional video on Salesforce mapping, click here.

    6. Click Next.

    7. In the Filters tab you can use saved searches as filters for synchronized fields.

  5. The Relation Mapping tab enables you to set 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.

  6. 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.

Additional Notes:

  1. 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:
    1. Lead table - compound field Company / Location Name should be not unique.
    2. 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.
  2. It is mandatory to match the required level of linked fields between  Agiloft and Salesforce for the tables you are setting up to sync.

    Example

    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.

  3. You can run the sync manually in a table's Action Bar by selecting Actions > Sync > Run <Salesforce account name>.

Sync automation

You can use a time-based rule to setup an automated sync process.

  1. Navigate to Setup > Sync / Edit the Salesforce configuration > Next > Next > Running tab > Select the 'By Actions (Rules/Workflow)' option > Finish.

  2. Navigate to Setup > Rules > New.
  3. In the Rule wizard, in the...
    1. General tab, enter a name and select a table.
    2. Rule Type tab, select At selected time intervals. 
    3. Condition tab, select Run once per scheduled time interval.
    4. Schedule tab, set Apply Rule = <as necessary>.
    5. Action tab, click the Create Sync Action button.
    6.  In the Sync Action wizard:
      1. Enter an action name.
      2. Select your configuration by performing a lookup for the External System ID control.
      3. Click Finish.
    7. 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.

Supported Table List

The following table lists all of the Salesforce tables which are supported in Agiloft sync. This list was taken on May 2015, and may differ if Salesforce adds or removes any tables in future.

AccountCampaignCollaborationInvitationEntitySubscription
AccountContactRoleCampaignMemberContactEvent
ActionLinkGroupTemplateCampaignMemberStatusContentDistributionEventRelation
ActionLinkTemplateCaseContentDocumentLinkExternalDataUserAuth
AdditionalNumberCaseCommentContentVersionFeedComment
AnnouncementCaseContactRoleContentWorkspaceDocFeedItem
ApexClassCaseSolutionContractFeedLike
ApexComponentCaseTeamMemberContractContactRoleFieldPermissions
ApexPageCaseTeamRoleCorsWhitelistEntryFolder
ApexTestQueueItemCaseTeamTemplateDandBCompanyGroup
ApexTriggerCaseTeamTemplateMemberDocumentGroupMember
AssetCaseTeamTemplateRecordDocumentAttachmentMapHoliday
AttachmentCategoryDataDuplicateRecordItemIdea
AuthProviderCategoryNodeDuplicateRecordSetIdeaComment
BrandTemplateCollaborationGroupEmailDomainKeyLead
BusinessHoursCollaborationGroupMemberEmailServicesAddressListViewChart
BusinessProcessCollaborationGroupMemberRequestEmailServicesFunctionMacro
CallCenterCollaborationGroupRecordEmailTemplateMacroShare
MailmergeTemplatePushTopicMobileDeviceRegistrarQueueSobject
NoteRecordTypeObjectPermissionsSearchPromotionRule
OpportunitySetupEntityAccessOpportunityCompetitorSolution
OpportunityContactRoleStaticResourceOpportunityLineItemStreamingChannel
OrderStreamingChannelShareOrderItemTask
OrgWideEmailAddressTopicPartnerTopicAssignment
PermissionSetUserPermissionSetAssignmentUserPackageLicense
PermissionSetLicenseAssignUserRolePricebook2UserShare
PricebookEntryVoteProduct2WebLink

Managing Attachments

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. 

  1. In the home page of the Salesforce Developer Console, click File > New > Apex Trigger
  2. Add a name - such as AttachmentTrigger - and select sObject = Attachment, and click Submit to save it. 
  3. In the console, enter the following code logic, customizing it to use your set of synchronized tables:

    trigger Attachment_Trigger on Attachment (after insert, before delete, after update) {
        Attachment file;
        String[] tableNames = new String[]{'Account','Asset'}; //Add tables based on your sync mapping.
            
            try {
                if(Trigger.isInsert || Trigger.isUpdate) {
                    file = Trigger.new[0];
                }
                if(Trigger.isDelete) {
                    file = Trigger.old[0];
                }
                System.debug('Attachment file: ' + file);
                Attachment parentDetails = [SELECT ParentId, Parent.Type FROM Attachment Where Id = :file.Id];
                System.debug('Parent Type of attachment file: ' + parentDetails.Parent.Type);
                for(String tableName : tableNames) {
                    if(tableName.equalsIgnoreCase(parentDetails.Parent.Type)) {
                        Sobject parentTable = Database.query('SELECT Id, Description FROM ' + parentDetails.Parent.Type + ' where Id=\''+parentDetails.ParentId+'\'');
                        parentTable.put('Description', parentTable.get('Description'));
                        update parentTable;                  
                    }
                }
            } catch (Exception e) {
                System.debug('Exception in attachment_trigger: ' + e);
            }       
    }
  4. Save the trigger. 

 

Agiloft