Customizing Event Connectors

An event connector is a type of form function that can run another function when Siebel CRM Desktop triggers a form event or a control event. This topic describes how to add two different example event connectors.

To customize event connectors

  1. Use a JavaScript editor to open the forms.js file.

  2. Locate the following section:

    //FORM EVENTS
    
  3. Add the event connectors that your customization requires to the section that you located in step 2.

    To link a function to the form event, you use the following format:

    ctx.form.event_type.connect(function_to_call); 
    

    If you link a control to the form event, you use the following format:

    ctx.events.connect(control_name, control_event, function_to_call);
    

    For example, the following code connects a form function to a form event:

    ctx.form.on_saving.connect(form_saving);
    

    In this example, Siebel CRM Desktop calls the form_saving function before it saves the record. It connects the on_saving event that resides in each form to a function that resides in the form handler for each object that the form.js file defines. To view another example of this usage, see Adding Postdefault Values to Fields.

    For another example, the following code connects the event that Siebel CRM Desktop uses with the sales_method field to the on_sales_method_changed function:

    ctx.events.connect(ctx.form["sales_method"], "changed", 
    on_sales_method_changed);
    

    This connect uses the following parameters to make the call:

    • Form control name

    • Event for the control

    • Function name

    To view more examples of this usage, see Updating One Field If the User Modifies Values In Another Field, and Linking Fields and Testing Your Hierarchical Picklist.