forked from TheVishnuKumar/OmniStudio-Recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyPicklistOptions.cls
38 lines (28 loc) · 2.21 KB
/
MyPicklistOptions.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
global class MyPicklistOptions implements vlocity_ins.VlocityOpenInterface{
public Boolean invokeMethod(String methodName,
Map < String, Object > input,
Map < String, Object > outMap,
Map < String, Object > options) {
if( methodName.equals('AccountNames') ){
List < Map < String, String >> UIoptions = new List < Map < String, String >> ();
for(Account acc : [Select id,Name from Account]){
Map < String, String > tempMap = new Map < String, String > ();
tempMap.put('name', acc.Id);
tempMap.put('value', acc.Name);
UIoptions.add(tempMap);
}
outMap.put('options', UIoptions);
}
else if( methodName.equals('ContactNames') ){
List < Map < String, String >> UIoptions = new List < Map < String, String >> ();
for(Contact con : [Select id,Name from Contact]){
Map < String, String > tempMap = new Map < String, String > ();
tempMap.put('name', con.Id);
tempMap.put('value', con.Name);
UIoptions.add(tempMap);
}
outMap.put('options', UIoptions);
}
return true;
}
}