SBM AppScript Reference → Introduction to SBM AppScript → SBM AppScript Contexts → Direct Access Contexts
Direct access contexts are quite different from transition-related contexts and do not require any administrative setup. These contexts do not execute in response to an SBM event. They are invoked when the server receives a URL of a certain form or encounters a certain HTML template tag. The following direct access contexts are available.
HTML Template – This context can call a script from any SBM HTML template and embed the output in the browser page or manipulate that result using JavaScript. For details, refer to HTML Template Direct Access Context.
URL – Any script can be called directly by accessing the proper URL and the script's HTML output is displayed in the browser. For details, refer to URL Direct Access Context.
If an HTML template contains the server-side instruction "$SCRIPT" (with proper parameters), the server runs the specified script. The $SCRIPT instruction has three valid forms where "..." denotes zero or more optional comma-separated parameters:
$SCRIPT( scriptName ... ) – Script names are visible in the Scripts editor in SBM Composer. Invoking scripts by name is the recommended form. Because the same script name can be used in multiple solutions, SBM tries to determine the current solution using parameters that are passed in as context. For example, if the template is an item view, the item is in a table that is associated with a solution; therefore, that solution is used. If possible, SBM uses that solution to find the script by the provided name. If a script for the contextual solution cannot be found, any script with the provided name is used instead.
$SCRIPT( scriptID ... ) – Every script in your SBM database has a name and a TS_ID column in the TS_MACROS table of the database. TS_IDs are assigned when the script is added to the SBM AppScript database and never change. Scripts should only be invoked by TS_ID if there is a name conflict or if you need to allow the script's name to be edited without breaking an HTML template.
$SCRIPT(SCRIPTUUID, uuid, ... ) – Scripts can be requested by UUID using SCRIPTUUID in the first parameter (all uppercase), followed by the script's UUID in the second parameter. The UUID for the script can be found in the TS_MACROS table of the database.
To interpret the first $SCRIPT parameter, the SBM server determines whether all characters are digits. If so, the parameter is taken as the script's TS_ID. Otherwise, the parameter is taken as the script's name, unless the first parameter is SCRIPTUUID.
Copyright © 2007–2017 Serena Software, Inc. All rights reserved.