How to iterate the array find some elements & pass their associated values to store in new variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:04 PM - edited 02-19-2024 10:09 PM
Hello @Ankur Bawiskar @Chuck Tomasi @Pradeep Sharma
We have an array retrieved from the "cmdb_ci_rel" table where the array contains the group's and their associated sys-id's but we are unable to iterate the array to find the values and then extract their sys_id to store these values in new variables which later needs to be passed in to another function
Sample array : [{"sys_id":"sys-id of the group","name":"group name "},{"sys_id":"sys-id of the group","name":"group name"},{"sys_id":"sys-id of the group","name":"group name"},{"sys_id":"sys-id of the group","name":"group name"}];
Can you suggest how we can interate , the group names are based on the CI in addition to certain suffixes of the groups where suffix could be something like approver , manager etc
Regards
Rochel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:58 PM
it's an array of json objects so you will require other logic.
Please refer script shared by @Tai Vu
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader