OpenInterface Interface

The OpenInterface provides user the capability to provide custom logic for task permitted by Salesforce.

Namespace 

industries_clm

OpenInterface Methods 

The following are methods for OpenInterface.

invokeMethod(var1, var2, var3) 

Invokes method based on the use-case.

Signature 

public Boolean invokeMethod(String var1, Map<String,Object> var2, Map<String,Object> var3)

Parameters 

var1

Type: String

Contains the name of the method that is supposed to be implemented from invoke method.

var2

Type: Map<String,ANY>

Contains the inputs as per the use-case.

var3

Type: Map<String,ANY>

Returns the output as per the use-case.

Return Value 

Type: Boolean

true or false

OpenInterface Example Implementation 

This is an example implementation of the industries_clm.OpenInterface interface.

1global class TestTF implements industries_clm.OpenInterface {
2public Boolean invokeMethod(String methodName, Map<String, Object> request, Map<String, Object> outMap) {
3Boolean success = true;
4if (methodName == 'getDocumentTemplateList') {
5getTemplateList(request, outMap);
6}
7return success;
8} 
9 
10private void getTemplateList(Map < String, Object > inputMap, Map < String, Object > outMap) {
11String contractId = (String) inputMap.get('contractId');
12String usageType = (String) inputMap.get('usageType');
13String billingCountry;
14List<Contract> contractList = [SELECT BillingCountry, Id FROM Contract where Id = :contractId];
15if(!contractList.isEmpty()) {
16Contract contract = contractList.get(0);
17billingCountry = contract.BillingCountry != null ? contract.BillingCountry : '';
18}
19List<DocumentTemplate> templist;
20String objName = 'DocumentTemplate';
21try {
22if(billingCountry.equalsIgnoreCase('India')) {
23templist = [select id, isActive, name, type, versionNumber from DocumentTemplate where IsActive=true and Type = 'MicrosoftWord' and Name like '%APAC%'
24order by Name];
25} else {
26templist = [select id, isActive, name, type, versionNumber from DocumentTemplate where IsActive=true and Type = 'MicrosoftWord' order by Name];
27}
28} catch (Exception e) {
29throw e;
30}
31if (tempList != null && tempList.size() > 0) {
32outMap.put('documentTemplateList', tempList);
33}
34}
35}