Testing an Event and Script Association

In this scenario we install a test script and we associate the test script with an event. When the event triggers, the script displays the “EVENT TEST” pop-up message.

You can associate the test script with any event. When the “EVENT TEST” message appears in a pop-up window, you know the event that triggered the test script.

During your script development, create the association between the test script and the event you want to script first, then replace the test script with your developed script. This way, you know that you associated the developed script with the correct event.

To create the test script

  1. From the Classic Admin portlet, click Admin Tools > Events > Scripts.

  2. Click Submit to return a list of existing scripts.

  3. Click Add.

  4. Enter the following two script lines in the Script Content section:

    aa.env.setValue("ScriptReturnCode","1"); 
    aa.env.setValue("ScriptReturnMessage", "EVENT TEST"); 
  5. Enter the name “EVENT_TEST” in the Script Code and Script Title sections.

  6. Click Add.

Topics

Associating the script to an event

To associate an event to the test script

  1. From the Classic Admin portlet, click Admin Tools > Events > Events.

  2. Click Submit to return a list of existing events.

  3. If required, add a new event.

    1. Click Add.

    2. Select the event name from the Events drop-down list, then click Add.

  4. Select an existing event by clicking on the red dot to the left of its name.

  5. From the Event Detail screen select the script “EVENT_TEST” from the Script Name drop-down list.

  6. Click Save.

Testing the event

Test the event to script association by triggering the event with a test case. For example, to test the “ApplicationSubmitAfter” event, create a new record of any type and click Submit, he “EVENT TEST” message appears in a pop-up window.

To disassociate the script from the event

  1. From the Classic Admin portlet, click Admin Tools > Events > Events.

  2. Click Submit to return a list of existing events.

  3. Select the event by clicking on the red dot to the left of its name.

  4. From the Script Name drop-down list, scroll to the top of the list and select the blank entry.

  5. Click Save.

To delete the event

  1. From the Classic Admin portlet, click Admin Tools > Events > Events.

  2. Click Submit to return a list of existing events.

  3. Select the event by clicking on the red dot to the left of its name.

  4. Click Delete to disable the event.

    Figure: Script and Event Detail pages