Defining Multiple Linked Fields

This task is a step in Process of Creating Dynamic Picklists That Use a SalesBook Control.

You can configure Siebel CRM Desktop to display multiple linked fields in the client. For example, it can display the phone number of the fulfillment center next to the name of the fulfillment center on the Opportunity form.

To define multiple linked fields

  1. Add the Fulfillment Center Phone field to the basic mapping. Do Adding Fields to the Basic Mapping to Support Static Picklists, but use the following code:

    <field id="Fulfillment Center Phone">
      <reader>
        <mapi_user>
          <user_field id="sbl Fulfillment Center Phone" ol_field_type="1"></
    user_field>
          <convertor>
            <string/>
          </convertor>
        </mapi_user>
      </reader>
      <writer>
        <Outlook_user>
          <user_field id="sbl Fulfillment Center Phone" ol_field_type="1"></
    user_field>
          <convertor>
            <string/>
          </convertor>
        </Outlook_user>
      </writer>
    </field>
    

    Bold text identifies the code that is different for this example.

  2. Locate the following code line in the code that you added in Modifying the Basic Mapping and Connector Configuration:

    <field from="Name" to="JVD Fulfillment Center"></field>
    
  3. Add the following code immediately after the code line you located in step 2:

    <field from="Main Phone Number" to="JVD Fulfillment Center Phone"></field>
    

    This code adds the link field for the phone number.

  4. Add the phone number field to the Opportunity form. Do Modifying the Form to Support Static Picklists, but use the following code:

    <edit id="jvd_fulfillment_center_phone">
      <field value="string">JVD Fulfillment Center Phone</field> 
    </edit>
    
  5. Use a JavaScript editor to open the forms.js file and then add the following code:

    ctx.form.jvd_fulfillment_center_phone.enabled = false;
    

    This code makes the phone number field read only.

  6. Add the following code to the opportunity_form function in the forms.js file:

    function on_fulfillment_center_changed()
    {
    ctx.form.jvd_fulfillment_center_phone.value = 
    ctx.form.item.snapshot['JVDFulfillment Center Phone'];
    }
    

    This function makes sure that Siebel CRM Desktop gets the value for the client from the data model. It makes sure the phone number field updates correctly in the client. If you do not include this code, and if the user chooses a fulfillment center in the SalesBook dialog box, then Siebel CRM Desktop updates the data correctly but it does not immediately update the value in the client for the Phone Number field.

  7. Make sure Siebel CRM Desktop calls the on_fulfillment_center_changed function. You add the following event connector:

    ctx.events.connect(ctx.form["jvd_fulfillment_center_id"],"changed",on_fulfillme
    nt_center_changed);
    

    For more information, see Customizing Event Connectors.

    To include more link fields, you can add another line for each link field that you must add in the on_fulfillment_center_changed function.