Oracle CRM On Demand Desktop Customization Guide > Adding Custom Fields to Oracle CRM On Demand Desktop >
Adding Multiselect Picklists to an Oracle CRM On Demand Desktop Form
This topic shows how to add multiselect picklists using an example. It expands on the information in Process of Adding Multiselect Picklists to a Form and shows you how to add the picklist into the Contact form in the UI. Use this example as a reference to add other multiselect picklist fields, and adjust them for your specific requirements. Before You Begin
Review the chapter on customization in Oracle CRM On Demand Desktop Administration Guide. The following procedure adds a multiselect picklist to the Contact form. Clicking the ... button in the multiselect picklist launches a dialog box to select field values. In this procedure, you update the following metadata files:
- od_meta_info.xml
- od_basic_mapping.xml
- forms_12.xml
- forms.js
For information on the contents of these files, see About the Metadata Files Updated During Customization. To add a multiselect picklist to an Oracle CRM On Demand Desktop form
- Define the objects and fields to synchronize with Oracle CRM On Demand as follows:
- Use an XML editor to open the od_meta_info.xml file.
- In the od_meta_info.xml file, locate the following element:
<object TypeId='Contact' ...>
Several child <field> elements reside in the <object TypeId='Contact' ...> element. These child elements define the fields in the Contact object.
- Add the following field element as a child to the <object TypeId='Contact' ...> element:
<field Name="msplTest_MSP" Label="msplTest_MSP" DataType="DTYPE_CSVLIST" HasPicklist="yes" IsFilterable='no'/>
In this example, msplTest_MSP is the field name that is used in SOAP queries.
- Save and close the od_meta_info.xml file.
- Map the multiselect picklist field from the Contact object in the Oracle CRM On Demand database to a field in Oracle CRM On Demand Desktop as follows:
- Use an XML editor to open the od_basic_mapping.xml file.
- In the od_basic_mapping.xml file, locate the following element:
<type id="Contact" ...>
Several child <field> elements reside in the <object TypeId='Contact' ...> element. These children define the fields in the Contact object.
- Add the following <field> elements as child elements of the <object TypeId='Contact' ...> element:
<type id="ContactmsplTest_MSPPicklist" icon="type_image:ContactmsplTest_MSPPicklist:16"> <field id ="Label"> <type> <simple type="string"/> </type> </field> <field id ="Value"> <type> <simple type="string"/> </type> </field> <field id ="SortOrder"> <type> <simple type="integer"/> </type> </field> <field id ="IsDefault"> <type> <simple type="boolean"/> </type> </field> </type>
- Create a new object type for the picklist.
To create a new object type for the picklist, you must use the following format for the type id attribute:
<type id="object_namefield_namePicklist" predefined_folder="1">
where:
<type id="ContactmsplTest_MSPPicklist" icon="type_image:ContactmsplTest_MSPPicklist:16"> <field id ="Label"> <type> <simple type="string"/> </type> </field> <field id ="Value"> <type> <simple type="string"/> </type> </field> <field id ="SortOrder"> <type> <simple type="integer"/> </type> </field> <field id ="IsDefault"> <type> <simple type="boolean"/> </type> </field> </type>
- Customize the multiselect picklist control on the form layout for the multiselect picklist by adding the following code in forms_12.xml in the vertical stack, as an example:
<cell size="21"> <stack layout="horz"> <cell> <scriptable_edit id="msp_edit" multiline="true"> <field value="string"></field> </scriptable_edit> </cell> <cell size="5"></cell> <cell size="22"> <button id="btn_msp_edit"><text>...</text> </button> </cell> </stack> </cell>
where:
- <scriptable_edit> is a text box with values.
- <button> is the multiselect picklist button that displays the multiselect picklist dialog box.
The number of items displayed in the multiselect picklist control is determined by the containing <cell> element size.
For more information on a vertical stack, see About Vertical and Horizontal Stacks.
- Customize a form handler in the forms.js file to set up multiselect picklist layout control by adding the following JavaScript code to the Contact form handler:
new msp_ctrl(ctx, ctx.form.msp_edit, ctx.form.btn_msp_edit, {"source_type": "ContactmsplTest_MSPPicklist", "dest_field_name": "msplTest_MSP"});
The msp_ctrl function accepts the following parameters, where:
About Vertical and Horizontal Stacks
A stack is a group of controls that are placed inside the <stack> element vertically or horizontally depending on the type of stack. The structure for a vertical stack is as follows: <stack layout="vertical"> <cell><button...></button></cell> <cell><button...></button></cell> </stack>
In this example, two buttons are placed vertically on the UI form. If you use a horizontal stack, then these buttons are placed horizontally on the UI form.
|