Create env variables in service now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 08:23 PM
How to create env variables as key value pairs and can it be used it in service now script ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 08:28 PM
You have dictionary type Name- value field type.
You can refer to below doc how to script these types of field:
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 08:42 PM
I think you can use system properties to store key-value pairs that act as environment variables for your scripts. These properties can then be accessed and utilized within your ServiceNow scripts.
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 09:15 PM
You can create system property to store key-value pairs as JSON and then read and parse it inside your script using below syntax :
var input = gs.getProperty('name of your system property');
parsedInput = JSON.parse(input);
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 11:25 PM - edited 02-28-2024 11:28 PM
getting error message when i am doing trigger business rule script : Illegal access to outbound HTTP in demo. Use an async business rule to perform outbound HTTP requests.
Business rule script :