Siebel CRM Desktop for Microsoft Outlook Administration Guide > Customizing Siebel CRM Desktop > Process of Customizing Objects in Siebel CRM Desktop >

Adding Custom Logic


This task is a step in Process of Customizing Objects in Siebel CRM Desktop.

To improve usability, sometimes you must add custom logic to Siebel CRM Desktop. Siebel CRM Desktop allows you to manipulate Microsoft Outlook data. For example:

  • Automatically include the ID of the current user in the Owner field.
  • Cause the first letter of each word in the description of an activity to automatically capitalize.
  • Change the state of some controls. For example, to inform the user that the control is required.

Siebel CRM Desktop uses JavaScript to handle custom manipulation of Microsoft Outlook data. Because Siebel CRM Desktop must run this JavaScript on certain events, you must define the exact events that are involved and specify the code that Siebel CRM Desktop must call at each event. To do this, you add the following attributes to the form tag:

<form id="SBL Activity" on_open="form_open()" on_saving="form_saving()">

Siebel CRM Desktop does the following work:

  • If the user opens the form, then Siebel CRM Desktop calls the form_open function.
  • If the user saves the form, then Siebel CRM Desktop calls the form_saving function.

You define these functions in the forms_12.xml file. For more information, see Correct Usage of the Forms_xx.XML File and Object ID.

To add custom logic

  1. Use an XML editor to open the forms_12.xml file.

    For more information, see About Files in the Customization Package.

  2. To add the custom logic for this example, add the following code:

    <form id="SBL Activity" on_open="form_open()" on_saving="form_saving()"">

    <validation_rules>

    (.................)

    </validation_rules>

    <script>

    <![CDATA[

    function form_open()

    {

    //this makes red border for these controls to inform users that

    //these fields are required

    form.Type.required = true;

    form["0x20017"].required = true;

    //this code pre-fill Owner field by Current user Id

    var defaults = find_item("::Defaults", create_criteria("or"));

    if (form.item.snapshot["Primary Owner Id"] != null)

    form.item["Primary Owner Id"] = defaults.CurrentUser;

    }

    function form_saving()

    {

    //this makes all first letters capitalized

    var fields = form.item.snapshot;

    form.item.Description = fields. Description.replace(/\b[a-z]/g,function(w){return w.toUpperCase()});

    }

    ]]>

    </script>

Siebel CRM Desktop for Microsoft Outlook Administration Guide Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices.