Trigger scripts

Run DB and API Script

Increment a number-field with 1 (with initial null-check):

record.u_MyIntField = record.u_MyIntField ? record.u_MyIntField + 1 : 1;

 

Set a date-field to current date and time:

record.u_MyDateField = DateTime.UtcNow;
record.u_MyDateField = DateTime.UtcNow.AddDays(7);
record.u_MyDateField = DateTime.UtcNow.AddHours(4);
record.u_MyDateField = DateTime.UtcNow.AddMinutes(40);


Other:

record.u_CreatedInBusinessHours = api.IsInsideBusinessHours(record, record.CreatedDate);
record.u_DurationInMinutes = api.CalculateDuration(record, record.CreatedDate, record.CloseDateTime);

More Trigger API examples you can find here.

 

Run PowerShell script

If you want to run PowerShell script you need to define script block as in example below. Enter tag [powershellscript] in beginning of script field. In configuration settings you need to add file name for script you want to execute. Script must be stored in specific folder according to global settings:

[powershellscript]
{ "TypeScript":"PowerShell", "SourceScriptFile":"myscript.ps1" }

PowerShell script need to be made as a standard script. Inside in script you can use all values from NSP record. See example below:

Write-Host "Hello, NSP ticket: {v:record.BaseHeader} by end user {v:record.BaseEndUser}. "

 

Read how to configure the system for running PowerShell scripts here.