Salesforce T4S API Code Examples

The T4S app will allow a generic Salesforce Org to securely transfer bulk Files and Attachments of all sizes from Salesforce into your internal Content Manager.

As you add your own custom objects and custom business rules into Salesforce or Content Manager, T4S can be extended with your custom code to meet these business rules.

T4S comes with a public Salesforce API class that will allow you to programmatically interact with T4S and the Content Manager TRIM Server through the T4S Server.

The global methods are available when you use the fuseit_t4s.TrimConnector.cls class.

Below is an example where you may wish to send all the current Account Trim Records with their Salesforce Files or Attachments to TRIM.

 

/***************************** * @method synchroniseAccounts * @description When called, find all Account Trim Records that are scheduled to be synced into TRIM * and call the T4S sync method. ****************************/ public static void synchroniseAccounts() { fuseit_t4s__Trim_Custom_Settings__c setting = fuseit_t4s__Trim_Custom_Settings__c.getInstance('Default'); Integer count = Integer.valueOf(setting.fuseit_t4s__Max_Bulk_Sync_Count__c); List<fuseit_t4s__Trim_Record__c> trimRecords = [Select Id, fuseit_t4s__Logging__c, fuseit_t4s__Trim_Status__c From fuseit_t4s__Trim_Record__c Where fuseit_t4s__Trim_Status__c = 'Scheduled' And fuseit_t4s__Parent_ID__c like '001%' WITH SECURITY_ENFORCED limit :count]; if(trimRecords.size() > 0) { for(fuseit_t4s__Trim_Record__c record : trimRecords) { record.fuseit_t4s__Logging__c = 'Accounts bulk sync at ' + String.valueOf(DateTime.now()); record.fuseit_t4s__Trim_Status__c = 'Processing'; } if (Schema.sObjectType.fuseit_t4s__Trim_Record__c.isUpdateable()){ update trimRecords; } fuseit_t4s.TrimConnector.synchroniseBulkRecords(trimRecords); } }