Free toolRuns in your browser · nothing is sent or stored
ServiceNow script generator
Choose the script type, the table and what it should do. Get a commented starter script that follows the platform’s best practices, ready to adapt in your instance.
What do you need?
Your script
Record settings
Starter code, not a finished script. Review it and test it in a sub-production instance before it goes anywhere near production.
Adding AI to these workflows? Start with ServiceNow AI integration: what actually works and 5 CSM workflows AI can take off your team’s plate, or see the ServiceNow AI integration service.
How it works
01
Choose the script type
Business rule, client script, script include, scheduled job or fix script. Each type has a few common jobs to pick from, not a blank page.
02
Fill in the fields it needs
Only the inputs the chosen job uses are shown: the field to watch, the value, the field to set. Names are checked as you type.
03
Copy the script and the settings
Next to the code you get the record settings to use: when the rule runs, on which operations, the client script type, whether the script include is client callable.
04
Read the notes before you test
Where a choice you made would cause trouble, such as setting a field after the save, the tool switches to the safer pattern and tells you why.
Questions
Is the generated code safe to paste straight into production?
No. It is starter code that follows the platform’s usual practices, but it knows nothing about your instance: your customisations, other business rules on the table, or your ACLs. Read it, adapt it, and test it in a sub-production instance first.
Why does it never call current.update() in a before business rule?
A before rule runs while the record is being saved, so changing current is enough: the save that is already happening writes it. Calling current.update() there saves the record a second time and runs the rules again.
Why use GlideAjax instead of GlideRecord in a client script?
GlideRecord in the browser makes a blocking call to the server for every lookup and returns whole records. A client-callable Script Include returns only the value you need, asynchronously, and runs the query on the server where ACLs and indexes apply.
Why gs.info and not gs.log?
gs.info works in global and scoped applications. The scoped GlideSystem API documents info, warn and error, not log, so gs.info keeps the script portable.
Does the tool see my instance or my code?
No. Everything is generated in your browser from what you type. Nothing is sent, stored or logged.
The next step
Want a person to look at your result?
A free tool gives you a first answer. The ServiceNow AI Integration service turns it into a plan for your business, with a fixed quote before any build.
Start a project