Add sys id servicenow
Options
- 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!
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2024 10:19 AM
Hello @servicenow14710
Thanks for clarifying the requirements.
Please try this script:
var grUser = new GlideRecord('sys_user'); //replace table name as per the requirement
grUser.addEncodedQuery('nameLIKEJUHI^active=true'); //Replace query as needed
grUser.query();
//use "while" if multiple records and "if" for single record
if(grUser.next()){
workflow.scratchpad.needed.push(grUser.sys_id); //push the new record sys_id
}
gs.info(workflow.scratchpad.needed);
Result:
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