Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Create the script

Create the script

By default, the Script field in the Software License Calculation form contains information about available variables and an example script.

You can use the example as the basis of the custom script or replace the example entirely.

You can use the following variables in the custom script.
Table 1. Custom script variables
Variable Description
found Contains a GlideRecord of the software install or software usage record currently being evaluated.
workstation Contains a GlideRecord of the workstation referenced by the found record.
user Contains a GlideRecord of the user referenced by the found record. Can be null if no user is assigned.
counter_id Contains the sys_id of the counter running the script.
query_table Identifies the table currently being queried, either Software Installation or Software Usage.
valuation Identifies the value in rights that is given to this software install or software usage record.

The following functions are available as part of the SAMUtil script include and can be used in custom scripts.

Note: All of these functions utilize and depend on the variables mentioned above.
Table 2. Custom script functions
Functions Description
getWorkstationInstallsOrUsages Returns a list of other installs on the given workstation.
getUserInstallsOrUsages Returns a list of all other installs belonging to the user.
createCounterViolation Returns insert a counter violation for the current counter with the given cause.


The following script uses the number of rights equal to the number of CPU sockets on the machine the script is installed on. The workstation variable is used to identify any workstation that is in the development environment. If such a workstation is found, the script then assigns a valuation equal to the number of CPU sockets on the machine. Otherwise, if the workstation is not in the development environment, then no rights are assigned.

Figure 1. SAM custom calculation type
SAM custom calculation type

Changes to site functionality will be made starting around 6am on January 21st (Pacific Time) and lasting approximately 6 hours.  The site may be intermittently unavailable.