Registering View Controls

This topic describes how to register a view control. To view an example that modifies the registration of a view control, see Removing Child Objects.

To register view controls

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

  2. Locate the form handler you must modify.

    For more information, see Customizing Form Handlers.

  3. Add the following code to the form handler you located in step 2.

    register_view_control_with_button(ctx, object_type, view_control, add_button, 
    delete_button, unlink_button, options)
    

    where:

    • ctx is a required parameter. You do not modify this parameter.

    • object_type identifies the object type that Siebel CRM Desktop displays in the view.

    • view_control identifies the name of the view control that Siebel CRM Desktop displays in the form. The forms_xx.xml file defines this control.

    • add_button identifies the name of the button control that the user clicks to add a record.

    • delete_button identifies the name of the button control that the user clicks to delete a record.

    • unlink_button identifies the name of the button control that the user clicks to remove a link that links one record to another record. If the view displays child objects, then you must set unlink_button to the following value:

      null
      
    • options allows you to specify more options. You can specify options to register a view control the same way you specify options to register an autocomplete control. For more information about these options and the format you must use, see Registering Autocomplete Controls.

      In addition to these options, it is recommended that you include the following option for every view you register. This option configures Siebel CRM Desktop to use custom view controls on an object form:

      {"custom_view_ctrl": true }
      

For example:

register_view_control_with_button(ctx, "Action", "activities_view", 
"btn_add_activity", "btn_remove_activity", null, {"custom_view_ctrl": true });

This code does the following work:

  • Displays actions in the view

  • Displays the activities_view view control in the form

  • Displays the btn_add_activity button that the user clicks to add an activity

  • Displays the btn_remove_activity button that the user clicks to delete an activity

  • Sets unlink_button to null because the view displays child objects

  • Uses custom view controls on an object form