![]() ClickLink API Developer's Reference
|
ffirule.RuleServiceglobal with sharing class RuleService Service class for managing and running ClickLink Rules. Methods
runglobal static List<Id> run(List<Id> sourceRecordIds, Id ruleId) Runs a ClickLink Rule. Input Parameters
Return ValueList of newly created target record IDs. Sample Code//Note: This sample code is for demonstration purposes only, it is not intended for //use in a production environment, is not guaranteed against defects or errors and //is in no way optimized or streamlined. Id ruleId = 'a0L2000000XICEr'; List<Account> accounts = [SELECT Id FROM Account WHERE Name = 'Example Account']; Set<Id> accountIds = new Map<Id, SObject>(accounts).keySet(); List<Id> targetIds = ffirule.RuleService.run(new List<Id>(accountIds), ruleId); runglobal static List<Id> run(List<Id> sourceRecordIds, String actionName, Boolean updateFeed) Runs a ClickLink Rule. Input Parameters
Return ValueList of newly created target record IDs. Sample Code//Note: This sample code is for demonstration purposes only, it is not intended for //use in a production environment, is not guaranteed against defects or errors and //is in no way optimized or streamlined. String actionName = 'Example action'; List<Account> accounts = [SELECT Id FROM Account WHERE Name = 'Example Account']; Set<Id> accountIds = new Map<Id, SObject>(accounts).keySet(); List<Id> targetIds = ffirule.RuleService.run(new List<Id>(accountIds), actionName, true); resolveActionsglobal static Map<SObjectType, List<ffirule.RuleService.Action>> resolveActions(Map<SObjectType, List<String>> sourceObjectActions) Retrieves ClickLink Actions for the supplied names. Input Parameters
Return ValueRuleService.Action objects, keyed by the SObjectType they relate to. Sample Code//Note: This sample code is for demonstration purposes only, it is not intended for //use in a production environment, is not guaranteed against defects or errors and //is in no way optimized or streamlined. Map<Schema.SObjectType, List<String>> actionNamesByObjectType = new Map<Schema.SObjectType, List<String>>{ Account.SObjectType => new List<String>{ 'Example Action 1', 'Example Action 2' } }; Map<Schema.SObjectType, List<ffirule.RuleService.Action>> actions = ffirule.RuleService.resolveActions(actionNamesByObjectType); cloneglobal static List<Id> clone(List<Id> ruleIds) Creates new ClickLink Rules by cloning existing ClickLink Rules and adding Clone to names of the newly created Rules. The existing Rules' Mappings, Relationships and detail-level Rules are also cloned. Input Parameters
Return ValueList of newly created ClickLink Rule IDs. Sample Code//Note: This sample code is for demonstration purposes only, it is not intended for //use in a production environment, is not guaranteed against defects or errors and //is in no way optimized or streamlined. List<ffirule__IntegrationRule__c> rules = [SELECT Id FROM ffirule__IntegrationRule__c WHERE Name = 'Example Rule']; Set<Id> ruleIds = new Map<Id, SObject>(rules).keySet(); List<Id> clonedRuleIds = ffirule.RuleService.clone(new List<Id>(ruleIds)); createMappingsglobal static List<Id> createMappings(List<ffirule.RuleService.CreateMappingInfo> createMappingInfos) Create ClickLink Mappings. Input Parameters
Return ValueList of newly created ClickLink Mapping IDs. Sample Code//Note: This sample code is for demonstration purposes only, it is not intended for //use in a production environment, is not guaranteed against defects or errors and //is in no way optimized or streamlined. ffirule.RuleService.CreateMappingInfo mapping = new ffirule.RuleService.CreateMappingInfo(); mapping.RuleId = 'a0I2000000DcfMX'; mapping.SourceField = c2g__WorkOrder__c.Id.getDescribe().getName(); mapping.TargetField = c2g__CodaInvoice__c.c2g__WorkOrder__c.getDescribe().getName(); List<ffirule.RuleService.CreateMappingInfo> mappings = new List<ffirule.RuleService.CreateMappingInfo>{mapping}; List<Id> actualMappingIds = ffirule.RuleService.createMappings(mappings); ffirule.RuleService.CreateMappingInfoglobal class CreateMappingInfo Describes a ClickLink Mapping. Properties
ffirule.RuleService.Actionglobal class Action Describes a ClickLink Action. Properties
|