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":"AsyncPowerShell", "SourceScriptFile":"myscript.ps1", "Parameters": {"servername": "AA", "envname": "V"}, "Arguments": ["A", 1, "b"]  }

PowerShell script needs to be made as a standard script. Inside the script you can use arguments and parameters from trigger script.

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