Java API:Customize

From AgileApps Support Wiki

The Customize Java APIs provide the ability to access metadata in Fields and Objects.

Field Metadata

addFieldMetaData

Description
Adds Field Metadata
Syntax
Functions.addFieldMetaData(FieldMetaDataBean fmdb);
Return
None

updateFieldMetaData

Description
Updates Field Metadata
Syntax
Functions.updateFieldMetaData(FieldMetaDataBean fmdb);
Return
None

deleteFieldMetaData

Description
Deletes Field Metadata
Syntax
Functions.deleteFieldMetaData(FieldMetaDataBean idBean);

where:

  • idBean - Contains the object ID and field ID for the field metadata to delete.
Return
None

getFieldMetaData

Description
Gets Field Metadata
Syntax
getFieldMetaData(String objectName,String fieldName); 
Return
Field bean metadata
Example
getFieldMetaData("LJObject","field_name"); 

getFieldMetaDataMap

Description
Gets a Field Metadata Map
Syntax
getFieldMetaDataMap(String objectName);
Return
Metadata map for all fields
Example
getFieldMetaDataMap("LJObject");

Payload Examples

Payload examples for the use case: Add Fields Metadata of the specified Field Display Types to an Object.

Considerations
  • The setObjectId() method in FieldMetaDataBean accepts object ID only. (Object name doesn't work.)

Check Box

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field11 = new FieldMetaDataBean(); field11.setTitle("API Check Box"); field11.setTableColumn("api_check_box"); field11.setType("BOOLEAN"); field11.setUniversalProperty(true); field11.setDescription("Check Box through JAVA API"); field11.setExtendedFieldMetaData("Extendedmeta data"); field11.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList11 = new ArrayList<CustomFieldVisibility>();
 CustomFieldVisibility cfv111 = new CustomFieldVisibility();

cfv111.setRoleId("1"); cfv111.setAttribute("HIDDEN"); cfvList11.add(cfv111);

CustomFieldVisibility cfv112 = new CustomFieldVisibility();

cfv112.setRoleId("2"); cfv112.setAttribute("VISIBLE"); cfvList11.add(cfv112);

CustomFieldVisibility cfv113 = new CustomFieldVisibility(); cfv113.setRoleId("3"); cfv113.setAttribute("READ_ONLY"); cfvList11.add(cfv113);

CustomFieldVisibility cfv114 = new CustomFieldVisibility();

cfv114.setRoleId("1714555710"); cfv114.setAttribute("HIDDEN"); cfvList11.add(cfv114);

 field11.setCustomFieldVisibility(cfvList11);

return field11; </syntaxhighlight>

Currency

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field6 = new FieldMetaDataBean(); field6.setTitle("API Currency"); field6.setTableColumn("api_currency"); field6.setType("CURRENCY"); field6.setUniversalProperty(true); field6.setMaxFractionalDigits(4); field6.setDisplayLength(35); field6.setDescription("Currency Field through JAVA API"); field6.setExtendedFieldMetaData("Extendedmeta data"); field6.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList6 = new ArrayList<CustomFieldVisibility>();
 CustomFieldVisibility cfv61 = new CustomFieldVisibility();

cfv61.setRoleId("1"); cfv61.setAttribute("HIDDEN"); cfvList6.add(cfv61);

 CustomFieldVisibility cfv62 = new CustomFieldVisibility();

cfv62.setRoleId("2"); cfv62.setAttribute("VISIBLE"); cfvList6.add(cfv62);

 CustomFieldVisibility cfv63 = new CustomFieldVisibility();

cfv63.setRoleId("3"); cfv63.setAttribute("READ_ONLY"); cfvList6.add(cfv63);

 CustomFieldVisibility cfv64 = new CustomFieldVisibility();

cfv64.setRoleId("1714555710"); cfv64.setAttribute("HIDDEN"); cfvList6.add(cfv64);

 field6.setCustomFieldVisibility(cfvList6);

fmdb.add(field6);

  field6.setCustomFieldVisibility(cfvList6);

return field6; </syntaxhighlight>

Date

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field18 = new FieldMetaDataBean(); field18.setTitle("API Date"); field18.setTableColumn("api_date"); field18.setType("DATE"); field18.setUniversalProperty(true); field18.setDescription("Date field through JAVA API"); field18.setExtendedFieldMetaData("Extendedmeta data"); field18.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

 List<CustomFieldVisibility> cfvList18 = new ArrayList<CustomFieldVisibility>();
 CustomFieldVisibility cfv181 = new CustomFieldVisibility();

cfv181.setRoleId("1"); cfv181.setAttribute("HIDDEN"); cfvList18.add(cfv181);

 CustomFieldVisibility cfv182 = new CustomFieldVisibility();

cfv182.setRoleId("2"); cfv182.setAttribute("VISIBLE"); cfvList18.add(cfv182);

CustomFieldVisibility cfv183 = new CustomFieldVisibility(); cfv183.setRoleId("3"); cfv183.setAttribute("READ_ONLY"); cfvList18.add(cfv183);

 CustomFieldVisibility cfv184 = new CustomFieldVisibility();

cfv184.setRoleId("1714555710"); cfv184.setAttribute("HIDDEN"); cfvList18.add(cfv184);

field18.setCustomFieldVisibility(cfvList18);

return field18; </syntaxhighlight>

DateTime

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field12 = new FieldMetaDataBean(); field12.setTitle("API Date Time"); field12.setTableColumn("api_date_time"); field12.setType("DATETIME"); field12.setUniversalProperty(true); field12.setDescription("Date Time through JAVA API"); field12.setExtendedFieldMetaData("Extendedmeta data"); field12.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

 List<CustomFieldVisibility> cfvList12 = new ArrayList<CustomFieldVisibility>();
  CustomFieldVisibility cfv121 = new CustomFieldVisibility();

cfv121.setRoleId("1"); cfv121.setAttribute("HIDDEN"); cfvList12.add(cfv121);

CustomFieldVisibility cfv122 = new CustomFieldVisibility(); cfv122.setRoleId("2"); cfv122.setAttribute("VISIBLE"); cfvList12.add(cfv122);

CustomFieldVisibility cfv123 = new CustomFieldVisibility();

cfv123.setRoleId("3"); cfv123.setAttribute("READ_ONLY"); cfvList12.add(cfv123);

 CustomFieldVisibility cfv124 = new CustomFieldVisibility();

cfv124.setRoleId("1714555710"); cfv124.setAttribute("HIDDEN"); cfvList12.add(cfv124);

field12.setCustomFieldVisibility(cfvList12);

return field12; </syntaxhighlight>

Double Field

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field10 = new FieldMetaDataBean(); field10.setTitle("API Double Field"); field10.setTableColumn("api_double_field"); field10.setType("DOUBLE"); field10.setUniversalProperty(true); field10.setMaxFractionalDigits(5); field10.setDisplayLength(30); field10.setDescription("Double Field through JAVA API"); field10.setExtendedFieldMetaData("Extendedmeta data"); field10.setObjectId("dd31e0408f3d4b059f57f3e154963d00"); List<CustomFieldVisibility> cfvList10 = new ArrayList<CustomFieldVisibility>();

CustomFieldVisibility cfv101 = new CustomFieldVisibility();

cfv101.setRoleId("1"); cfv101.setAttribute("HIDDEN"); cfvList10.add(cfv101);

CustomFieldVisibility cfv102 = new CustomFieldVisibility();

cfv102.setRoleId("2"); cfv102.setAttribute("VISIBLE"); cfvList10.add(cfv102);

CustomFieldVisibility cfv103 = new CustomFieldVisibility();

cfv103.setRoleId("3"); cfv103.setAttribute("READ_ONLY"); cfvList10.add(cfv103);

CustomFieldVisibility cfv104 = new CustomFieldVisibility(); cfv104.setRoleId("1714555710"); cfv104.setAttribute("HIDDEN"); cfvList10.add(cfv104); field10.setCustomFieldVisibility(cfvList10); return field10; </syntaxhighlight>

Email Address

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field5 = new FieldMetaDataBean(); field5.setTitle("API Email Address"); field5.setTableColumn("api_mail_address"); field5.setType("LEAD_EMAIL"); field5.setUniversalProperty(true); field5.setMaxStorageLength(50); field5.setDisplayLength(35); field5.setDescription("Email address through JAVA API"); field5.setExtendedFieldMetaData("Extendedmeta data"); field5.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList5 = new ArrayList<CustomFieldVisibility>();
  CustomFieldVisibility cfv51 = new CustomFieldVisibility();

cfv51.setRoleId("1"); cfv51.setAttribute("HIDDEN"); cfvList5.add(cfv51);

CustomFieldVisibility cfv52 = new CustomFieldVisibility();

cfv52.setRoleId("2"); cfv52.setAttribute("VISIBLE"); cfvList5.add(cfv52);

 CustomFieldVisibility cfv53 = new CustomFieldVisibility();

cfv53.setRoleId("3"); cfv53.setAttribute("READ_ONLY"); cfvList5.add(cfv53);

CustomFieldVisibility cfv54 = new CustomFieldVisibility(); cfv54.setRoleId("1714555710"); cfv54.setAttribute("HIDDEN"); cfvList5.add(cfv54);

field5.setCustomFieldVisibility(cfvList5); return field5; </syntaxhighlight>

Look Up

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field9 = new FieldMetaDataBean(); IDBean idbean = new IDBean(); field9.setTitle("API Look Up"); field9.setTableColumn("api_look_up"); field9.setType("LOOKUP"); field9.setUniversalProperty(true); idbean.setValue("9d86c06bd9974f35bdfc9c3b155ea21c"); field9.setLookUpObjectId(idbean);

   // field9.setLookupPresetFilter(( First Name equals John ) and ( Date Created greater than 4/23/2010 ));

field9.setIsMasterDetailRelationship(false); field9.setPostSelectionJS("alert('You have selected record :' + name) ;"); field9.setDescription("Look Up through JAVA API"); field9.setExtendedFieldMetaData("Extendedmeta data"); field9.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

  LookupPresetFilters lpf = new LookupPresetFilters();

lpf.setCriteria_1_pre_bracket("("); lpf.setCriteria_1_column("field_name"); lpf.setCriteria_1_operator("equals"); lpf.setCriteria_1_value("John"); lpf.setCriteria_1_post_bracket(")"); lpf.setCriteria_2_join_operator("and"); lpf.setCriteria_2_pre_bracket("("); lpf.setCriteria_2_column("date_created "); lpf.setCriteria_2_operator("greater than"); lpf.setCriteria_2_value("4/23/2010"); lpf.setCriteria_2_post_bracket(")");

 field9.setLookupPresetFilter(lpf);
  List<CustomFieldVisibility> cfvList9 = new ArrayList<CustomFieldVisibility>();
  CustomFieldVisibility cfv91 = new CustomFieldVisibility();

cfv91.setRoleId("1"); cfv91.setAttribute("HIDDEN"); cfvList9.add(cfv91);

 CustomFieldVisibility cfv92 = new CustomFieldVisibility();

cfv92.setRoleId("2"); cfv92.setAttribute("VISIBLE"); cfvList9.add(cfv92);

 CustomFieldVisibility cfv93 = new CustomFieldVisibility();

cfv93.setRoleId("3"); cfv93.setAttribute("READ_ONLY"); cfvList9.add(cfv93);

 CustomFieldVisibility cfv94 = new CustomFieldVisibility();

cfv94.setRoleId("1714555710"); cfv94.setAttribute("HIDDEN"); cfvList9.add(cfv94);

  field9.setCustomFieldVisibility(cfvList9);

return field9; </syntaxhighlight>

Multi-Select Check Box

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field15 = new FieldMetaDataBean(); field15.setTitle("API Multi Check Box"); field15.setTableColumn("api_multi_chk_box"); field15.setType("MULTI_CHECK_BOX"); field15.setUniversalProperty(true); field15.setDescription("Multi Check Box through JAVA API"); field15.setExtendedFieldMetaData("Extendedmeta data"); field15.setObjectId("dd31e0408f3d4b059f57f3e154963d00"); EnumerationDetailsBean eD2 = new EnumerationDetailsBean();

   eD2.setShowFirstValueAsDefault(false);

eD2.setSortFlag(false); List<EnumerationDetailsBean.EnumerationItemBean> eIList1 = new ArrayList<EnumerationDetailsBean.EnumerationItemBean>();

EnumerationDetailsBean.EnumerationItemBean eI1 = new EnumerationDetailsBean.EnumerationItemBean(); eI1.setPicklistLabel("1"); eI1.setPicklistValue("a"); eI1.setTextColor("#000000"); eI1.setTextBgColor("#FFFFFF"); eI1.setShowOnlyImage(false); eI1.setFlagIsOptgroup(false);

eIList1.add(eI1); EnumerationDetailsBean.EnumerationItemBean eI11 = new EnumerationDetailsBean.EnumerationItemBean(); eI11.setPicklistLabel("2"); eI11.setPicklistValue("b"); eI11.setTextColor("#000000"); eI11.setTextBgColor("#FFFFFF"); eI11.setShowOnlyImage(false); eI11.setFlagIsOptgroup(false); eIList1.add(eI11); EnumerationDetailsBean.EnumerationItemBean eI12 = new EnumerationDetailsBean.EnumerationItemBean(); eI12.setPicklistLabel("3"); eI12.setPicklistValue("c"); eI12.setTextColor("#000000"); eI12.setTextBgColor("#FFFFFF"); eI12.setShowOnlyImage(false); eI12.setFlagIsOptgroup(false); eIList1.add(eI12); eD2.setEnumerationItems(eIList1); field15.setEnumerationDetails(eD2); List<CustomFieldVisibility> cfvList15 = new ArrayList<CustomFieldVisibility>(); CustomFieldVisibility cfv151 = new CustomFieldVisibility(); cfv151.setRoleId("1"); cfv151.setAttribute("HIDDEN"); cfvList15.add(cfv151); CustomFieldVisibility cfv152 = new CustomFieldVisibility(); cfv152.setRoleId("2"); cfv152.setAttribute("VISIBLE"); cfvList15.add(cfv152);

CustomFieldVisibility cfv153 = new CustomFieldVisibility(); cfv153.setRoleId("3"); cfv153.setAttribute("READ_ONLY"); cfvList15.add(cfv153);

CustomFieldVisibility cfv154 = new CustomFieldVisibility(); cfv154.setRoleId("1714555710"); cfv154.setAttribute("HIDDEN"); cfvList15.add(cfv154);

 field15.setCustomFieldVisibility(cfvList15);

return field15; Global Pick List

FieldMetaDataBean field16 = new FieldMetaDataBean();

field16.setTitle("API Global Pick List"); field16.setTableColumn("api_global_pick_list"); field16.setType("GLOBAL_PICK_LIST"); field16.setUniversalProperty(true); IDBean idbean1 = new IDBean(); idbean1.setValue("case_reason"); field16.setGlobalPicklistId(idbean1); field16.setDescription("Global Pick list through JAVA API"); field16.setExtendedFieldMetaData("Extendedmeta data"); field16.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList16 = new ArrayList<CustomFieldVisibility>();
 CustomFieldVisibility cfv161 = new CustomFieldVisibility();

cfv161.setRoleId("1"); cfv161.setAttribute("HIDDEN"); cfvList16.add(cfv161);

CustomFieldVisibility cfv162 = new CustomFieldVisibility();

cfv162.setRoleId("2"); cfv162.setAttribute("VISIBLE"); cfvList16.add(cfv162);

CustomFieldVisibility cfv163 = new CustomFieldVisibility();

cfv163.setRoleId("3"); cfv163.setAttribute("READ_ONLY"); cfvList16.add(cfv163);

 CustomFieldVisibility cfv164 = new CustomFieldVisibility();

cfv164.setRoleId("1714555710"); cfv164.setAttribute("HIDDEN"); cfvList16.add(cfv164);

field16.setCustomFieldVisibility(cfvList16);

return field16; </syntaxhighlight>

Number

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field2 = new FieldMetaDataBean(); field2.setTitle("API Number"); field2.setTableColumn("api_number"); field2.setType("NUMBER"); field2.setUniversalProperty(true); field2.setMaxStorageLength(50); field2.setDisplayLength(35); field2.setMinNumericValue(-2147483648); field2.setMaxNumericValue(2147483647); field2.setDescription("Text field through JAVA API"); field2.setExtendedFieldMetaData("Extended meta data"); field2.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList2 = new ArrayList<CustomFieldVisibility>();

CustomFieldVisibility cfv11 = new CustomFieldVisibility(); cfv11.setRoleId("1"); cfv11.setAttribute("HIDDEN"); cfvList2.add(cfv11);

CustomFieldVisibility cfv12 = new CustomFieldVisibility(); cfv12.setRoleId("2"); cfv12.setAttribute("VISIBLE"); cfvList2.add(cfv12);

CustomFieldVisibility cfv13 = new CustomFieldVisibility(); cfv13.setRoleId("1"); cfv13.setAttribute("HIDDEN"); cfvList2.add(cfv13);

CustomFieldVisibility cfv14 = new CustomFieldVisibility(); cfv14.setRoleId("1714555710"); cfv14.setAttribute("HIDDEN"); cfvList2.add(cfv14);

field2.setCustomFieldVisibility(cfvList2); return field2; </syntaxhighlight>

Percent

<syntaxhighlight lang="java" enclose="div">
  FieldMetaDataBean field17 = new FieldMetaDataBean();

field17.setTitle("API Percent"); field17.setTableColumn("api_percent"); field17.setType("PERCENT"); field17.setUniversalProperty(true); field17.setMaxFractionalDigits(2); field17.setDisplayLength(35); field17.setDescription("Percentage field through JAVA API"); field17.setExtendedFieldMetaData("Extendedmeta data"); field17.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList17 = new ArrayList<CustomFieldVisibility>();
 CustomFieldVisibility cfv171 = new CustomFieldVisibility();

cfv171.setRoleId("1"); cfv171.setAttribute("HIDDEN"); cfvList17.add(cfv171);

 CustomFieldVisibility cfv172 = new CustomFieldVisibility();

cfv172.setRoleId("2"); cfv172.setAttribute("VISIBLE"); cfvList17.add(cfv172);

CustomFieldVisibility cfv173 = new CustomFieldVisibility();

cfv173.setRoleId("3"); cfv173.setAttribute("READ_ONLY"); cfvList17.add(cfv173);

CustomFieldVisibility cfv174 = new CustomFieldVisibility(); cfv174.setRoleId("1714555710"); cfv174.setAttribute("HIDDEN"); cfvList17.add(cfv174);

 field17.setCustomFieldVisibility(cfvList17);

return field17; </syntaxhighlight>

Phone/Fax

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field3 = new FieldMetaDataBean(); field3.setTitle("API Phone Fax"); field3.setTableColumn("api_phone_fax"); field3.setType("PHONE"); field3.setUniversalProperty(true); field3.setMaxStorageLength(50); field3.setDisplayLength(35); field3.setDescription("Phone field through JAVA API"); field3.setExtendedFieldMetaData("Extendedmeta data"); field3.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList3 = new ArrayList<CustomFieldVisibility>();

CustomFieldVisibility cfv31 = new CustomFieldVisibility(); cfv31.setRoleId("1"); cfv31.setAttribute("HIDDEN"); cfvList3.add(cfv31);

CustomFieldVisibility cfv32 = new CustomFieldVisibility(); cfv32.setRoleId("2"); cfv32.setAttribute("VISIBLE"); cfvList3.add(cfv32);

CustomFieldVisibility cfv33 = new CustomFieldVisibility(); cfv33.setRoleId("4"); cfv33.setAttribute("READ_ONLY"); cfvList3.add(cfv33);

CustomFieldVisibility cfv34 = new CustomFieldVisibility(); cfv34.setRoleId("1714555710"); cfv34.setAttribute("HIDDEN"); cfvList3.add(cfv34);

field3.setCustomFieldVisibility(cfvList3); return field3; </syntaxhighlight>

Pick List

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field8 = new FieldMetaDataBean(); field8.setTitle("API Pick List"); field8.setTableColumn("api_pick_list"); field8.setType("PICK_LIST"); field8.setUniversalProperty(true); field8.setDescription("Pick List through JAVA API"); field8.setExtendedFieldMetaData("Extendedmeta data"); field8.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

EnumerationDetailsBean eD = new EnumerationDetailsBean();

eD.setShowFirstValueAsDefault(false); eD.setSortFlag(false); field8.setEnumerationDetails(eD);

List<CustomFieldVisibility> cfvList8 = new ArrayList<CustomFieldVisibility>();
 CustomFieldVisibility cfv81 = new CustomFieldVisibility();

cfv81.setRoleId("1"); cfv81.setAttribute("HIDDEN"); cfvList8.add(cfv81);

CustomFieldVisibility cfv82 = new CustomFieldVisibility();

cfv82.setRoleId("2"); cfv82.setAttribute("VISIBLE"); cfvList8.add(cfv82);

CustomFieldVisibility cfv83 = new CustomFieldVisibility();

cfv83.setRoleId("3"); cfv83.setAttribute("READ_ONLY"); cfvList8.add(cfv83);

CustomFieldVisibility cfv84 = new CustomFieldVisibility();

cfv84.setRoleId("1714555710"); cfv84.setAttribute("HIDDEN"); cfvList8.add(cfv84); field8.setCustomFieldVisibility(cfvList8); return field8; </syntaxhighlight>

RadioButton

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field14 = new FieldMetaDataBean(); field14.setTitle("Api RadioButton"); field14.setTableColumn("api_rdbutton"); field14.setType("RADIO_BUTTON"); field14.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

EnumerationDetailsBean eD1 = new EnumerationDetailsBean(); eD1.setShowFirstValueAsDefault(false); eD1.setSortFlag(false); List<EnumerationDetailsBean.EnumerationItemBean> eIList = new

 ArrayList<EnumerationDetailsBean.EnumerationItemBean>();  
  

EnumerationDetailsBean.EnumerationItemBean eI = new EnumerationDetailsBean.EnumerationItemBean(); eI.setPicklistLabel("label1"); eI.setPicklistValue("value1"); eI.setTextColor("#FFFFFF"); eI.setTextBgColor("#000000"); eI.setShowOnlyImage(false); eI.setFlagIsOptgroup(false);

  eIList.add(eI);

EnumerationDetailsBean.EnumerationItemBean eI1 = new EnumerationDetailsBean.EnumerationItemBean(); eI1.setPicklistLabel("label2"); eI1.setPicklistValue("value2"); eI1.setTextColor("#FFFFFF"); eI1.setTextBgColor("#000000"); eI1.setShowOnlyImage(false); eI1.setFlagIsOptgroup(false);

   eIList.add(eI1);
   

EnumerationDetailsBean.EnumerationItemBean eI2 = new EnumerationDetailsBean.EnumerationItemBean(); eI2.setPicklistLabel("label3"); eI2.setPicklistValue("value3"); eI2.setTextColor("#FFFFFF"); eI2.setTextBgColor("#000000"); eI2.setShowOnlyImage(false); eI2.setFlagIsOptgroup(false);

   eIList.add(eI2); 

eD1.setEnumerationItems(eIList); field14.setEnumerationDetails(eD1); List<CustomFieldVisibility> cfvList14 = new ArrayList<CustomFieldVisibility>(); CustomFieldVisibility cfv141 = new CustomFieldVisibility(); cfv141.setRoleId("1"); cfv141.setAttribute("HIDDEN"); cfvList14.add(cfv141);

   CustomFieldVisibility cfv142 = new CustomFieldVisibility();

cfv142.setRoleId("2"); cfv142.setAttribute("VISIBLE"); cfvList14.add(cfv142);

 CustomFieldVisibility cfv143 = new CustomFieldVisibility();

cfv143.setRoleId("3"); cfv143.setAttribute("READ_ONLY"); cfvList14.add(cfv143);

CustomFieldVisibility cfv144 = new CustomFieldVisibility();

cfv144.setRoleId("1714555710"); cfv144.setAttribute("HIDDEN"); cfvList14.add(cfv144);

 field14.setCustomFieldVisibility(cfvList14);

return field14; </syntaxhighlight>

RichText Area

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field4 = new FieldMetaDataBean(); field4.setTitle("API Rich Text Area"); field4.setTableColumn("api_rich_text_area"); field4.setType("RICHTEXT_AREA"); field4.setUniversalProperty(true); field4.setWidth(500); field4.setDescription("Rich Text Area through JAVA API"); field4.setExtendedFieldMetaData("Extendedmeta data"); field4.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

List<CustomFieldVisibility> cfvList4 = new ArrayList<CustomFieldVisibility>();

CustomFieldVisibility cfv41 = new CustomFieldVisibility(); cfv41.setRoleId("1"); cfv41.setAttribute("HIDDEN"); cfvList4.add(cfv41);

CustomFieldVisibility cfv42 = new CustomFieldVisibility(); cfv42.setRoleId("2"); cfv42.setAttribute("VISIBLE"); cfvList4.add(cfv42);

CustomFieldVisibility cfv43 = new CustomFieldVisibility(); cfv43.setRoleId("3"); cfv43.setAttribute("READ_ONLY"); cfvList4.add(cfv43);

CustomFieldVisibility cfv44 = new CustomFieldVisibility(); cfv44.setRoleId("1714555710"); cfv44.setAttribute("HIDDEN"); cfvList4.add(cfv44);

field4.setCustomFieldVisibility(cfvList4); return field4; </syntaxhighlight>

Text Area

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field1 = new FieldMetaDataBean(); field1.setTitle("API Name"); field1.setTableColumn("api_name"); field1.setType("TEXT_FIELD"); field1.setUniversalProperty(true); field1.setMaxStorageLength(50); field1.setDisplayLength(29); field1.setDescription("Text field through JAVA API"); field1.setExtendedFieldMetaData("Extendedmeta data"); field1.setObjectId("dd31e0408f3d4b059f57f3e154963d00"); List<CustomFieldVisibility> cfvList1 = new ArrayList<CustomFieldVisibility>();

CustomFieldVisibility cfv1 = new CustomFieldVisibility(); cfv1.setRoleId("1"); cfv1.setAttribute("HIDDEN"); cfvList1.add(cfv1);

CustomFieldVisibility cfv2 = new CustomFieldVisibility(); cfv2.setRoleId("2"); cfv2.setAttribute("VISIBLE"); cfvList1.add(cfv2);

CustomFieldVisibility cfv3 = new CustomFieldVisibility(); cfv3.setRoleId("1"); cfv3.setAttribute("HIDDEN"); cfvList1.add(cfv3);

CustomFieldVisibility cfv4 = new CustomFieldVisibility(); cfv4.setRoleId("1714555710"); cfv4.setAttribute("HIDDEN"); cfvList1.add(cfv4);

field1.setCustomFieldVisibility(cfvList1); return field1; </syntaxhighlight>

Time

<syntaxhighlight lang="java" enclose="div">

FieldMetaDataBean field13 = new FieldMetaDataBean(); field13.setTitle("API Time"); field13.setTableColumn("api_time"); field13.setType("TIME"); field13.setUniversalProperty(true); field13.setDescription("Time through JAVA API"); field13.setExtendedFieldMetaData("Extendedmeta data"); field13.setObjectId("dd31e0408f3d4b059f57f3e154963d00");

  List<CustomFieldVisibility> cfvList13 = new ArrayList<CustomFieldVisibility>();

CustomFieldVisibility cfv131 = new CustomFieldVisibility(); cfv131.setRoleId("1"); cfv131.setAttribute("HIDDEN"); cfvList13.add(cfv131);

 CustomFieldVisibility cfv132 = new CustomFieldVisibility();

cfv132.setRoleId("2"); cfv132.setAttribute("VISIBLE"); cfvList13.add(cfv132);

 CustomFieldVisibility cfv133 = new CustomFieldVisibility();

cfv133.setRoleId("3"); cfv133.setAttribute("READ_ONLY"); cfvList13.add(cfv133);

CustomFieldVisibility cfv134 = new CustomFieldVisibility();

cfv134.setRoleId("1714555710"); cfv134.setAttribute("HIDDEN"); cfvList13.add(cfv134);

field13.setCustomFieldVisibility(cfvList13);
return field13;

</syntaxhighlight>


Object Metadata

Object metadata is the data that describes an object--it's name, for example, and it's ID.

getObjectMetaData

Description
Retrieves metadata from Custom Objects; not available for System Objects
Syntax
CustomObjectMetaDataBean Functions.getObjectMetaData(String objectName)
       /* where objectName is the Custom Object name */
Example
<syntaxhighlight lang="java" enclose="div">

Logger.info("Initiate Object Meta Data Retrieval", "Metadata"); CustomObjectMetaDataBean comdb = Functions.getObjectMetaData(String objectName) Logger.info(("Object Display Title : "+ comdb.getDisplayTitle(), "Metadata"); </syntaxhighlight>

getObjectMetaDataMap

Description
Returns a map of all visible Custom Objects with object_id as the key and the corresponding object's metadata as a value
Syntax
Map Functions.getObjectMetaDataMap()
Example
<syntaxhighlight lang="java" enclose="div">

Logger.info("Initiate Object Meta Data Retrieval", "Metadata"); Map comdbCollection = Functions.getObjectMetaDataMap() for(Map.Entry e:comdbCollection.entrySet())

   {
   CustomObjectMetaDataBean bean = e.getValue();
   Logger.info("Object ID :" + e.getKey(), "Metadata");
   Logger.info(" Object Display Title:" + bean.getDisplayTitle(), "Metadata");
   }

</syntaxhighlight>

addObjectMetaData

Description
Adds an object and returns the id of the newly created object
Syntax
String Functions.addObjectMetaData(CustomObjectMetaDataBean comdb)
Considerations
  • Object names:
  • Must start with an alphabetic character.
  • May contain only alphanumeric (a-z A-Z 0-9) and underscores (_).
  • May not contain spaces or other characters.
  • Must be 32 characters or less.
Example
<syntaxhighlight lang="java" enclose="div">

Logger.info("Initiate Add object", "Metadata"); CustomObjectMetaDataBean omdb = new CustomObjectMetaDataBean (); omdb.setDisplayTitle("JAVA API OBJECT"); omdb.setSingluarDisplayTitle("JAVA API OBJECT"); omdb.setBuiltIn(false); omdb.setNameColumn("name"); omdb.setWebTab(false); omdb.setObjectName("API_OBJ"); String new_object_id = Functions.addObjectMetaData(omdb); Logger.info("Added an object:"+new_object_id, "Metadata"); </syntaxhighlight>

updateObjectMetaData

Description
Updates an object and returns the id of the updated object
Syntax
String Functions.updateObjectMetaData(CustomObjectMetaDataBean comdb)
Example
<syntaxhighlight lang="java" enclose="div">

CustomObjectMetaDataBean omdb = Functions.getObjectMetaData("API_OBJ"); omdb.setDisplayTitle("JAPIOBJ"); Functions.updateObjectMetaData(omdb); </syntaxhighlight>

deleteObjectMetaData

Description
Deletes an object
Syntax
Functions.deleteObjectMetaData(CustomObjectMetaDataBean comdb)
Example
<syntaxhighlight lang="java" enclose="div">

Functions.deleteObjectMetaData( Functions.getObjectMetaData("API_OBJ")); </syntaxhighlight>

getRecordLocator

Get a record locator bean from the specified object, which contains the Key, Lookup, and Search settings,
where:

  • Key - The concatenation of fields that constitutes the Record_Locator#Search_Fields examined by the platform when searching for records.
  • Search - The concatenation of fields that constitutes the Lookup and Search Results fields that are displayed to the user during a search or Lookup.
  • Lookup - The concatenation of fields that constitutes the record identifier, displayed as the value of a Lookup field after a selection has been made.
Syntax
<syntaxhighlight lang="java" enclose="div">

RecordLocatorBean rlb = Functions.getRecordLocator(String objectName); </syntaxhighlight>

Parameters
objectName - The object name or identifier.
Returns
RecordLocatorBean
Throws
Exception
Example
<syntaxhighlight lang="java" enclose="div">

public Map testGetLookupRecordLocatorColumns() throws Exception { RecordLocatorBean rb = Functions.getRecordLocator("Students");

   Map<String, String> m = new HashMap<String, String>();
   String lookupString = "";
   for(String s : rb.getLookupColumns())
   {
       lookupString = lookupString + s;
   }
   m.put("lookupColumnsRecordLocator",lookupString);
   return m;

} </syntaxhighlight>

updateRecordLocator

Modify an object's Record Locator Settings:

Syntax
<syntaxhighlight lang="java" enclose="div">

String objectId = Functions.updateRecordLocator(RecordLocatorBean rlb); </syntaxhighlight>

Parameters
RecordLocatorBean - The object with the values to store.
Returns
A string containing the ID of the updated object
Throws
Exception
Example
<syntaxhighlight lang="java" enclose="div">

public Map testUpdateSearchRecordLocator() throws Exception {

RecordLocatorBean rlb = Functions.getRecordLocator("Students");
    Map<String, String> m = new HashMap<String, String> ();
    List<String> looklist = new ArrayList<String>();
    looklist.add("emergency_phone");
    looklist.add("student_name");
    rlb.setSearchColumns(looklist);
    Functions.updateRecordLocator(rlb);
    String lookupString = "";
    for (String s: rlb.getLookupColumns())
    {
        lookupString = lookupString + s;
    }
    m.put("updatedSearchColumnsRecordLocator", lookupString);
    return m;

} </syntaxhighlight>