AgileApps Support Wiki Pre Release

addGlobalPicklist

From AgileApps Support Wiki

Create a new Global Picklist.

Syntax
<syntaxhighlight lang="java" enclose="div">
 String addGlobalPicklist(GlobalPicklistBean bean) throws Exception  

</syntaxhighlight>

Parameters
Returns
A string containing the ID of the new global picklist.
Throws
Exception
Example
This example creates a new Global Picklist ('Order Status'), with two enumerated values - 'New' and 'Processed'.
<syntaxhighlight lang="java" enclose="div">

import com.platform.beans.*; import com.platform.beans.EnumerationDetailsBean.EnumerationItemBean; ...

try {

 GlobalPicklistBean bean = new GlobalPicklistBean();
 bean.setTitle ("Order Status");
 bean.setDescription ("Picklist to track the status of an Order");
 bean.setShowFirstValueAsDefault(true);    
 bean.setSortFlag(true);
 bean.setAllowSubscriberToModify(true);
 bean.setAllowSubscriberToDelete(false);
 bean.setAllowSubscriberToAdd(true);
 List<EnumerationItemBean> items = new ArrayList<EnumerationItemBean>();
 EnumerationItemBean item1 = new EnumerationItemBean();
 item1.setPicklistValue("1");
 item1.setPicklistLabel("New");
 item1.setTextColor("#FFFFFF");
 item1.setTextBgColor("#000000");
 item1.setShowOnlyImage(false);
 item1.setFlagIsOptgroup(false);
 items.add(item1);
 EnumerationItemBean item2 = new EnumerationItemBean();
 item2.setPicklistValue("2");
 item2.setPicklistLabel("Processed");
 item2.setTextColor("#FFFFFF");
 item2.setTextBgColor("#000000");
 item2.setShowOnlyImage(false);
 item2.setFlagIsOptgroup(false);    
 items.add(item2);
 bean.setEnumerationItems(items);
 String id = Functions.addGlobalPicklist(bean);  

} catch (Exception e) {

 ...

} </syntaxhighlight>