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 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

  1. Define the objects and fields to synchronize with Oracle CRM On Demand as follows:
    1. Use an XML editor to open the od_meta_info.xml file.
    2. In the od_meta_info.xml file, locate the following element:

    <object TypeId='Contact' ...>

    The <object> element contains several child <field> elements. These child elements define the fields in the Contact object.

    1. Add the following <field> element as a child of 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.

    1. Save and close the od_meta_info.xml file.
  2. 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:
    1. Use an XML editor to open the od_basic_mapping.xml file.
    2. In the od_basic_mapping.xml file, locate the following element:

    <type id="Contact" ...>

    The <object> element contains several child <field> elements. These children define the fields in the Contact object.

    1. Add the following <field> element as a child element of the <object TypeId='Contact' ...> element:

    <field id="msplTest_MSP">
      <reader>
        <mapi_user>
          <user_field id="od msplTestMSP" ol_field_type="1">
          </user_field>
            <convertor>
              <multivalue_string/>
            </convertor>
        </mapi_user>
      </reader>
      <writer>
        <outlook_user>
          <user_field id="od msplTestMSP" ol_field_type="1">
          </user_field>
            <convertor>
              <multivalue_string/>
            </convertor>
        </outlook_user>
      </writer>
    </field>

    1. 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 value of the id attribute of the <type> element:

    <type id="object_namefield_namePicklist" predefined_folder="1">

    where:

    • object_name is the name of the object type in the od_meta_info.xml file.
    • field_name is the name of the field that resides in the object that you define in object_name.

      In this example, add the following XML code inside the <database><types>...</types></database> elements:

    <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>

  3. 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 value of the size attribute of the containing <cell> element.

      For more information on a vertical stack, see About Vertical and Horizontal Stacks.

  4. Customize a form handler in the forms.js file to set up a multiselect picklist layout control by adding the following JavaScript code to the Contact form handler:

    var t_msp = 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:

    • ctx is a global object that includes many other objects used to display the UI form and to control events, links, and so on.
    • ctx.form.msp_edit is the <scriptable_edit> control object. The msp_edit portion must be an appropriate scriptable edit form control ID from the forms_XX.xml file. This control is defined using the <scriptable_edit id="..."> element that is specific to an example. This control object contains the reference to the scriptable edit control with the msp_edit identifier, defined in Step 3. The ctx.form portion is a generic string that is left unchanged.
    • ctx.form.btn_msp_edit is the <button> control object. The btn_msp_edit portion must be an appropriate button form control ID from the forms_XX.xml file; this control is defined using the <button id="..."> element that is specific to an example. This control object contains the reference to the button control with the btn_msp_edit identifier defined in Step 3. The ctx.form portion is a generic string that is left unchanged.
    • {"source_type": "ContactmsplTest_MSPPicklist", "dest_field_name": "msplTest_MSP"}

      This options object has the following properties, where:

      • source_type is the name of the type where picklist items are stored. This property is required.
      • dest_field_name is the name of the MSP field. This property is required.
      • ui_delimiter is the delimiter for selected items that is used on the form. The delimiter is a comma (,) by default. (Optional)
      • max_selected is the number of allowed items that can be selected. The default is 10. (Optional)

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 the buttons are placed horizontally on the UI form.

Oracle CRM On Demand Desktop Customization Guide, Version 5.2 Revision A Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.