Work with scripts
You can integrate custom scripts in your business logic by creating new scripts and editing or enabling existing ones. Depending on your use case, there are different script types with different context properties.
We recommend that you keep the total script runtime below 10 minutes. After 12 minutes, the script worker considers the script stuck and starts a new worker to relaunch it. This can cause resource depletion and data inconsistency.
When using scripting, you can't change the minimum log level on the default IMClient.Logger
. You can change it on the Scripts page instead. By default, the minimum log level is not set and displays None
. This defaults to the Info
log level in the SDK.
The maximum limit of log entries per script is 50.
Create a script
To create a script:
-
On the menu bar, click Manage .
-
On the Manage page, click Scripts.
-
On the Scripts page, click Script.
-
In the Script dialog, enter a name and a description and select a script type.
-
To run the script with the permissions and identity of the user who triggered it, select the Execute script as user check box. If this option is not selected, the script is run using default user settings and permissions.
-
If you want to create another script, select the Create another check box.
-
Click Save. If you selected the Create another check box, a Script dialog appears where you can create another script. If you are not creating another item, the Scripts page opens.
NoteWhen you create another item, some of the fields are prefilled with values you already defined.
-
On the Scripts page, click the new script and then click Edit in the upper right-hand corner.
-
Enter your script code in the text area, then click Build.
-
If the script builds without errors, click Done. If not, fix the errors and build again.
-
To apply your code changes, click Publish.
Edit a script
To edit a script:
-
On the menu bar, click Manage .
-
On the Manage page, click Scripts.
-
On the Scripts page, click the script you want to edit and then click Edit in the upper right-hand corner.
-
Make any necessary edits and click Save changes.
-
Click Build.
-
If the script builds without errors, click Close. If not, fix the errors and build again.
Enable or disable a script
To enable or disable a script:
-
On the menu bar, click Manage .
-
On the Manage page, click Scripts.
-
On the Scripts page, next to the script you want to enable or disable, turn the Enable control switch on or off.