Returning a value

Home » Other Functions » Javascript » Returning a value
Javascript No Comments

Javascript

No attempt should be made to alter existing TLP scripts and we will not be liable for any damage caused by such action. It is recommended that any new scripts you wish to apply should first be done in the Test system before being migrated to the Live system.

Return a Value

A simple script to return a value that will be set into a calculated fiel

String(98765);

Or

Number(12345)

For calculated fields all output values must be string or number otherwise the UI cannot render them – so for dates/times/booleans etc. the script should format the output as String or Number.

Same Thing as a Scriptlet

Scriptlets are a better way to handle scripts as they keep them all in one place and can be referenced / used from many places, so changing the scriptlet changes the behaviour for all the places it’s used at once.

script1

To use the scriptlet assuming it’s stored in the system with id ‘testScriptlet’, set the calculated field to use scriptlet, scriptlet = testScriptlet and function = myTest();