Oracle CRM On Demand Desktop Customization Guide > Adding Custom Fields to Oracle CRM On Demand Desktop >
Adding Currency Fields to a Form
This topic describes how to display a currency field, using a currency control on an Oracle CRM On Demand Desktop form. Although the currency control has field text in its name, it is a currency control. <currency_field>CurrencyCode</currency_field>
In this example, you add an Annual Revenues currency field to the UI form. In this procedure, you update the following metadata files:
- od_meta_info.xml
- od_basic_mapping.xml
- forms_12.xml
- package_res.xml
For information on the contents of these files, see About the Metadata Files Updated During Customization. To add a currency control field to a form
- Update the od_meta_info.xml file as follows:
- Add the following two field definitions for the proper type where the currency code and the currency amount are stored:
<field Name="CurrencyCode" Label="CurrencyCode" DataType="DTYPE_TEXT" HasPicklist="yes" PicklistTypeId='CurrencyPL' IsFilterable='yes'/>
<field Name="AnnualRevenues" Label="AnnualRevenues" DataType="DTYPE_NUMBER" IsFilterable='yes'/>
- Add the type definition that requires these fields, for example, for Opportunity:
<object TypeId='Opportunity' Label='#obj_opportunity'...> <field Name="CurrencyCode".../> <field Name="AnnualRevenues".../> ... </object>
- Update the od_basic_mapping.xml file by adding the following XML section to the type definition that requires these fields:
<field id="CurrencyCode"> <reader> <mapi_user> <user_field id="od CurrencyCode" ol_field_type="1"></user_field> <convertor> <string/> </convertor> </mapi_user> </reader> <writer> <outlook_user> <user_field id="od CurrencyCode" ol_field_type="1"></user_field> <convertor> <string/> </convertor> </outlook_user> </writer> </field>
<field id="AnnualRevenues"> <reader> <mapi_user> <user_field id="od AnnualRevenues" ol_field_type="3"></user_field> <convertor> <double/> </convertor> </mapi_user> </reader> <writer> <outlook_user> <user_field id="od AnnualRevenues" ol_field_type="3"></user_field> <convertor> <double/> </convertor> </outlook_user> </writer> </field>
For example, for Opportunity, the structure is similar to the following:
<type id="Opportunity" display_name="#obj_opportunity_plural"...> <field id="CurrencyCode".../> <field id="AnnualRevenues".../> ... </type>
- Update the forms_12.xml file by adding the following XML sample code to update the UI layout by adding the label for the currency field:
<cell size="22"> <multi_currency id="AnnualRevenues" tab_order="46"> <currency_field>CurrencyCode</currency_field> <value_field>AnnualRevenues</value_field> </multi_currency> </cell>
In this example, <currency_field> and <value_field> are the field names from the od_basic_mapping.xml file.
Add this code to the appropriate object type form, for example:
<form id="SBL Opportunity"> ... <cell size="22"> <multi_currency id="AnnualRevenues" tab_order="46"> ... </form>
The steps for adding labels are provided in Changing the XML Code in the forms_12.xml File and are the same as for a text field.
- Update the package_res.xml file by adding the resources for the label text.
The steps for adding the resources are provided in Changing the XML Code in the package_res.xml File and are the same as for a text field.
|