---
sourceDocument: Australia IT Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/it-service-management

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Create a custom script for a legacy Software Asset Management plugin license type

# Create a custom script for a legacy Software Asset Management plugin license
type {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
By default, the Script field in the legacy Software Asset Management (com.snc.software_asset_management) plugin 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.{#r_CreateTheScript__table_rk2_b5f_4s__entry__2}

| 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. |
[Table 1. Custom script variables]

{#r_CreateTheScript__table_rk2_b5f_4s}

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.
{#r_CreateTheScript__table_ev5_f5f_4s__entry__2}

| 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. |
[Table 2. Custom script functions]

{#r_CreateTheScript__table_ev5_f5f_4s}

Example:

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

