Adding Event Trigger Scripts: Procedures
This section contains procedural examples of creating general, performer, and submap event scripts, along with how to restrict access to event scripts.This example describes how to create a general event trigger script that is used to update a workflow attribute. This general event trigger script walks through all of the different types of data that are flowing through the workflow (the work package) and locates the attributes RecArray. It then walks through all of the attributes in the RecArray, locates the one that you want to update, and updates the attribute by saving new data from the workflow.
To create the general event trigger script:The GeneralCallbackScripts object is registered in WFCBGeneralSubsystem, and the Event Scripts tab is exposed in the Content Server interface.
You have provided the information necessary to display the Update Workflow Attribute option on the Event Scripts tab in the Content Server interface. Now, you must provide the code that the ChangeAttribute() script requires to perform the operation.
You can use breakpoints to debug event trigger scripts in the same way that you use breakpoints to debug other scripts in the Livelink Builder; however, placing a breakpoint in an event trigger script always returns a workflow error. Some calls in the event trigger scripts (especially those that use WAPIWORK) will fail if you have added breakpoints. When you finish debugging event trigger scripts, you must remove the breakpoints that you have added.
Another way to debug callback scripts is to send messages to the Builder's Debug window using the Echo function. For more information about the Echo function, see the Livelink Builder Developer's Guide.
Procedure for Creating Performer Event Scripts: Assigning Steps to Workflow ParticipantsThis example describes how to create a performer event trigger script that is used to locate a workflow attribute named username. This performer event trigger script locates the user associated with this attribute and assigns the next workflow step to them.
To create the performer event trigger script:The PerformerCallbackScripts object is registered in WFCBPerformerSubsystem, and the Event Scripts tab is exposed in the Content Server interface.
You have provided the information necessary to display the Choose User option on the Event Scripts page in the Content Server interface. Now you must provide the code that the ChooseUser() script requires to perform the operation.
Procedure for Creating Submap Event Scripts: Defining Sub-workflows On-The-FlyThis example describes how to create a submap event trigger script that is used to define a Sub-workflow map and save the map definition in WAPI. This map definition instructs Content Server to assign the same task to each Content Server user in the user list.
To create the submap event trigger script:The SubmapCallbackScripts object is registered in WFCBSubmapSubsystem, and the Event Scripts tab is exposed in the Content Server interface.
You have provided the information necessary to display the Generate Sub-workflow option on the Event Scripts tab in the Content Server interface. Now you must provide the code that the subworkflow() script requires to perform the operation.
Restricting Access to Event Trigger ScriptsCreating event trigger scripts lets the creators of workflows access the Event Scripts tab in the Content Server interface, where they can add custom operations to specific workflow events. This means that the creators of workflows can determine which operation to perform when a specific workflow event occurs in the execution of a workflow.
If you want to restrict access to an event trigger script that you add to Content Server, you can modify the fObjectFactory feature and the FactoryName() script associated with the corresponding event trigger object. Similarly, if you want to specify which Content Server users can attach a performer event trigger script to the Assign Step Performer workflow event, you can modify the fObjectFactory feature and the FactoryName() script contained in the performer event trigger object in your custom module. If you want to specify which Content Server users can attach a submap event trigger script to the Determine Sub-Map To Use workflow event, you can modify the fObjectFactory feature and the FactoryName() script contained in the submap event trigger object.
To restrict access to event trigger scripts:
This string value is displayed in the Usage Privileges section of the Administer Object and Usage Privileges page.
You can restrict access to general event trigger scripts, performer event trigger scripts, and submap event trigger scripts individually by setting different return values for the FactoryName() scripts for each event trigger object. You can restrict access to all general event trigger scripts, performer event trigger scripts, and submap event trigger scripts together by setting the same return values for the FactoryName() scripts for each event trigger object.
After you modify the fObjectFactory features and the FactoryName() scripts contained in the event trigger objects for the event trigger scripts to which you want to restrict access, you must run the BuildOSpace() script in the Globals object of your custom OSpace. Then, the Admin user can go to the Administer Object and Usage Privileges section of the Content Server Administration page and specify which Content Server users can attach the event trigger scripts to workflow events.
Suppose that you create general, performer, and submap event trigger scripts in your custom module and you want to restrict access to the performer and submap event trigger scripts. You can set the fObjectFactory feature to TRUE and modify the FactoryName() script to return the same string value in the performer and submap event trigger objects. This means that the Admin user can specify which Content Server users can attach the performer and submap event trigger scripts to workflow events. In this case, certain Content Server users can attach the performer and submap event trigger scripts to workflow events and all Content Server users can attach the general event trigger scripts to workflow events.