Add sys id servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2024 04:39 AM
Hello developers, i have an implementation where i need to add a sys id to an already existing array(this array values has been glided and result has been pushed.Any suggestions is appreciated. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2024 04:43 AM
To clarify, do you want the sysID to be the key of the array?
Or do you want to push the sysID into the array as well? If so, what is the other of the array? How will it look like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2024 04:45 AM - edited ‎11-15-2024 04:46 AM
Hello @Joe Wong , thanks for quick response
array is like
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2024 05:08 AM
Hello @servicenow14710
The best way to add sys_id is to add them in system properties.
Steps to meet the requirement:
- Create a new record in "sys_properties" table
- Use this property to get the sys_id. Here is the updated script:
var propertyValue = gs.getProperty('community Help'); // Replace 'community Help' with your actual system property name.
workflow.scratchpad.needed.push(propertyValue);
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2024 09:48 AM
Hi @Juhi Poddar : i need to add the new sys_id to already existing array which is like workflow.scratchpad.needed.push(gr1.getValue('sys_id'));
eg: workflow.scratchpad.needed = [a,b,c]
new static sys_id ='z';
it should be workflow.scratchpad.needed = ['a','b','c','z']Note:'a','b','c','d' - are all sys_id's. Thanks!