Customizing Triggers

A trigger is a type of function that Siebel CRM Desktop calls if an event occurs. If Siebel CRM Desktop creates or removes a link, and if a trigger exists for this link, then Siebel CRM Desktop calls this trigger.

To customize triggers

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

  2. Locate the form handler you must modify.

    You can add a trigger anywhere in the form handler or in the business_logic.js file in the section that starts with the following code:

    with (scheme.triggers)
    
  3. Add the triggers that your customization requires to the form handler that you located.

    You use the following format to add a trigger:

    ctx.triggers.add_simple_trigger(function_name, link_source, link_destination, 
    link_tag, link_operation);
    

    where:

    • function_name specifies the name of the function that Siebel CRM Desktop must call.

    • link_source specifies the object type that Siebel CRM Desktop uses as the link source.

    • link_destination specifies the object type that Siebel CRM Desktop uses as the link destination.

    • link_tag identifies the tag. The tag you specify depends on the following function that defines the relationship that exists between objects. This function resides in the business_logic.js file:

      • add_direct_link. You set link_tag to direct. For example, to support a user who uses the autocomplete list to create the link from an opportunity object to an account object.

      • add_mvg_link. You set link_tag to mvg. For example, to support a user who uses a multivalue group to create a link between object types.

    • link_operation specifies when Siebel CRM Desktop runs the trigger. You can use one of the following values:

      • created. Siebel CRM Desktop runs the trigger if the user creates the link. For example, if the user adds a new account to an opportunity.

      • removed. Siebel CRM Desktop runs the trigger if the user removes the link. For example, if the user deletes an existing account from an opportunity.

    In the following example, if the user adds an account to an opportunity, then Siebel CRM Desktop calls the on_update_account function:

    ctx.triggers.add_simple_trigger(on_update_account, "Opportunity", "Account", 
    "direct", "created");
    

    For an example that uses a trigger, see Allowing Users to Open Top-Level Objects from the Control Panel.