Oracle CRM On Demand Desktop Administration Guide > Customizing Oracle CRM On Demand Desktop > Roadmap for Adding an MVG Field >
Example Code You Use to Add an MVG
This topic describes some of the code you use to add an MVG in this example. It includes the following information:
Code to Add a Custom Object Type
To add a custom object type, you add the following code to the od_meta_info.xml file. To assist with debugging, it is recommended that you place this code after the last Type definition: <object TypeId='ChannelPartner' Label='Channel Partner' LabelPlural='Channel Partners' EnableGetIDsBatching='true' ViewMode='Sales Rep' IntObjName='Channel Partner' SiebMsgXmlElemName='ChannelPartner' SiebMsgXmlCollectionElemName='ListOfChannelPartner' > <field Name='DS Updated' Label='DS Updated' DataType='DTYPE_DATETIME' IsFilterable='no' IsHidden='yes' IOElemName='DSUpdated' /> <field Name='Id' Label='Id' IsPrimaryKey='yes' DataType='DTYPE_ID' IsFilterable='no' IsHidden='yes' IOElemName='Id'/> <field Name='Name' Label='Name' DataType='DTYPE_TEXT' IsPartOfUserKey='yes' IOElemName='Name' /> <field Name='Location' Label='Location' DataType='DTYPE_TEXT' IsPartOfUserKey='yes' IOElemName='Location'/> </object>
This code does the following:
Code to Map a Custom Object
You can map a field of an Oracle CRM On Demand object to a Microsoft Outlook field or to a custom Oracle CRM On Demand Desktop field. For example, you can do the following:
- Map the Name field in Oracle CRM On Demand to the LastName field in Microsoft Outlook
- Map the mapLocation field in Microsoft Outlook to the Location field in Oracle CRM On Demand
To map objects, you add the following code to the od_basic_mapping.xml file: <type id="Currency" icon="type_image:Currency:16"> <field id ="Name"> <type> <simple type="string"/> </type> </field> <field id ="Currency Symbol"> <type> <simple type="string"/> </type> </field> </type>
Note the following requirements:
Code to Configure the Synchronization of a Custom Object
To configure synchronization for a custom object, you add the following code to the connector_configuration.xml file: <type id="ChannelPartner"> <view label="Channel Partner" label_plural="Channel Partners" small_icon="type_image:Account:16" normal_icon="type_image:Account:24" large_icon="type_image:Account:48"></view> <synchronizer name_format=":[:(Name):]"> <links></links> <natural_keys> <natural_key> <field>Name</field> <field>Location</field> </natural_key> </natural_keys> </synchronizer> </type>
Note the following:
- The value in the type id element must equal the value in the TypeId object in the meta_info.xml file.
- The natural_key element includes the Name and Location fields as part of the user key.
Code to Add a Lookup View
To add a lookup view, add the following code to the lookup_view_defs.xml file: <lookup_view_def key="lookup:channel_partners"> <display name="Channel Partners"></display> <filter dasl="[http://schemas.microsoft.com/mapi/proptag/0x001A001E] >= 'IPM.Contact.OnDemand.Channel_Partner' AND [http://schemas.microsoft.com/mapi/ proptag/0x001A001E] <= 'IPM.Contact.OnDemand.Channel_Partner'"></filter> <view id="channel_partner:salesbook"></view> <quick_lookup dasl_format="[http://schemas.microsoft.com/mapi/id/{00062004-0000- 0000-C000-000000000046}/8005001E] = '%s'"></quick_lookup> <type id=""></type> </lookup_view_def>
Table 18 describes important attributes you use in this code.
Table 18. Attributes in the Code to Add a Lookup View
|
|
key |
Id of the lookup control. |
display name |
Caption of the lookup control. |
filter |
Object that Oracle CRM On Demand Desktop displays on the lookup control. To specify an object type, use the message_type attribute from the od_basic_mapping.xml file. |
view |
Id of the salesbook control that Oracle CRM On Demand Desktop uses for this lookup. |
type id |
The type of object that Oracle CRM On Demand Desktop creates if the user clicks New on the lookup control. If this attribute is empty, then Oracle CRM On Demand Desktop disables the button. |
Code to Add a View
To add the definition for a view, add the following code to the views.xml file: <str key="channel_partner:mvg"> <![CDATA[<?xml version="1.0"?> <view type="table"> <viewname>Phone List</viewname> <viewstyle>table-layout:fixed;width:100%;font-family:Segoe UI;font- style:normal;font-weight:normal;font-size:8pt;color:Black;font-charset:0</ viewstyle> <viewtime>0</viewtime> <linecolor>8421504</linecolor> <linestyle>3</linestyle> <gridlines>1</gridlines> <collapsestate/> <rowstyle>background-color:window;color:windowtext</rowstyle> <headerstyle>background-color:#D3D3D3</headerstyle> <previewstyle/> <arrangement> <autogroup>0</autogroup> <collapseclient/> </arrangement> <multiline> <width>0</width> </multiline> <column> <name>HREF</name> <prop>DAV:href</prop> <checkbox>1</checkbox> </column> <column> <type>string</type> <heading>Name</heading> <prop>http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000- 000000000046}/od%20PartnerName</prop> <width>426</width> <style>padding-left:3px;;text-align:left</style> <editable>1</editable> <userheading>Name</userheading> </column> <column> <type>string</type> <heading>Location</heading> <prop>http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000- 000000000046}/od%20PartnerLocation</prop> <width>426</width> <style>padding-left:3px;;text-align:left</style> <editable>1</editable> <userheading>Location</userheading> </column> <orderby> <order> <heading>File As</heading> <prop>urn:schemas:contacts:fileas</prop> <type>string</type> <sort>asc</sort> </order> </orderby> <groupbydefault>0</groupbydefault> <previewpane> <markasread>0</markasread> </previewpane> </view>]]> </str>
Code to Add a New Association
To add a new association, add the following code to the business_logic.js file: { var opportunity_channel_partner = add_mvg_link("Opportunity", "ChannelPartner", "Primary Partner Id", null, "Opportunity.Channel_Partner.Association", "OpportunityId", "ChannelPartnerId", null, "ChannelPartnerStatus", null, ["lookup:channel_partners"], false, false, false, true); deny_primary_delete(opportunity_channel_partner.mvg1);//optional opportunity_channel_partner.mvg1.dialog_template_params = "dialog_caption": "#obj_activity_employee_plural", "autocomplete_display_format": ":[:(Name):]", "associations_view_caption": "#head_associated_channel", "associations_view_id": "channel_partner:mvg", "primary_selector_display_format": ":[:(PartnerName):]" }
The ChannelPartnerStatus field contains the status of the Channel Partner object, such as unsaved, deleted, and so on. Table 19 describes the important attributes you can use with the add_mvg_link function.
Table 19. Attributes in the Code to Add a New Association
|
|
left_type |
The type of the first linked object, for example, Opportunity. |
right_type |
The type of the second linked object, for example, Channel Partner. |
left_obj_primary |
The field of the Opportunity object. This field contains the primary Id for the Channel Partner object. |
right_obj_primary |
The field of the Channel Partner object. This field contains the primary Id for the Opportunity object. |
assoc_type |
The Id of the association type described in the od_meta_info.xml file and the od_basic_mapping.xml file. |
left_link |
The field of the association object that contains the Id of the opportunity. |
right_link |
The field of the association object that contains the Id of the channel partner. |
left_assoc_status |
The field of the association that contains the status of the opportunity. |
right_assoc_status |
The field of the association that contains the status of the channel partner. |
left_objs_view_ids |
The list of lookup view definitions you must use to display opportunity objects. |
right_objs_view_ids |
The list of lookup view definitions you must use to display channel partner objects. |
left_primary_refresh_required |
If the primary object is changed, and if the left_primary_refresh_required attribute is true, then Oracle CRM On Demand Desktop updates the object Id for the primary field of the opportunity that you specify in the left_obj_primary attribute. If you use the writer class="link_fields" element in the od_basic_mapping.xml file for this field, then set the left_primary_refresh_required attribute to True. |
right_primary_refresh_required |
If the primary object is changed, and if the right_primary_refresh_required attribute is true, then Oracle CRM On Demand Desktop updates the object Id for the primary field of the channel partner that you specify in the right_obj_primary attribute. If you use the writer class="link_fields" element in the od_basic_mapping.xml file for this field, then set the right_primary_refresh_required attribute to True. |
assoc_left_link_refresh_required |
If the opportunity object is changed, then Oracle CRM On Demand Desktop updates the OpportunityId field of the association that you specify in the left_link attribute. If you use the writer class="link_fields" element in the od_basic_mapping.xml file for this field, then set the assoc_left_link_refresh_required attribute to True. |
assoc_right_link_refresh_required |
If the channel partner object is changed, then Oracle CRM On Demand Desktop updates the ChannelPartnerId field of the association that you specify in the right_link attribute. If you use the writer class="link_fields" element in the od_basic_mapping.xml file for this field, then set the assoc_right_link_refresh_required attribute to True. |
Code to Define a SalesBook Control
To define a SalesBook control, add the following code to the views.xml file. <str key="channel_partner:salesbook"> <![CDATA[<?xml version="1.0"?> <view type="table"> <viewname>Phone List</viewname> <viewstyle>table-layout:fixed;width:100%;font-family:Segoe UI;font-style:normal;font-weight:normal;font-size:8pt;color:Black;font-charset:0</viewstyle> <viewtime>0</viewtime> <linecolor>8421504</linecolor> <linestyle>3</linestyle> <gridlines>1</gridlines> <newitemrow>1</newitemrow> <collapsestate/> <rowstyle>background-color:window;color:windowtext</rowstyle> <headerstyle>background-color:#D3D3D3</headerstyle> <previewstyle/> <arrangement> <autogroup>0</autogroup> <collapseclient/> </arrangement> <multiline> <width>0</width> </multiline> <column> <name>HREF</name> <prop>DAV:href</prop> <checkbox>1</checkbox> </column> <column> <heading>Last Name</heading> <prop>urn:schemas:contacts:sn</prop> <type>string</type> <width>322</width> <style>padding-left:3px;;text-align:left</style> <editable>1</editable> </column> <column> <type>string</type> <heading>Location</heading> <prop>http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000- 000000000046}/od%20Location</prop> <width>322</width> <style>padding-left:3px;;text-align:left</style> <editable>1</editable> <userheading>Location</userheading> </column> <orderby> <order> <heading>File As</heading> <prop>urn:schemas:contacts:fileas</prop> <type>string</type> <sort>asc</sort> </order> </orderby> <groupbydefault>0</groupbydefault> <previewpane> <markasread>0</markasread> </previewpane> </view>]]> </str>
|