Workflow Studio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi,
I am currently using a REST API within Workflow Studio to retrieve data, which includes the host_id of hosts that have been updated on the endpoints. Once this data is obtained, I need to iterate through each host_id, make a subsequent REST API call to retrieve detailed information for each host, and then update the corresponding records in the cmdb_ci_network_host and cmdb_ci_hardware tables using the Reconciliation Engine.
Could you please advise on the best approach or best practices for implementing this workflow efficiently?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago - last edited 11 hours ago
Hi @ChoudhryA ,
For this type of workflow, you’ll likely need a custom solution, since flow designer doesn’t natively handle iterating over arrays from REST responses. A common pattern is:
Initial REST step – Call your endpoint and retrieve the list of updated host_ids
Script step – Parse the response and extract the array of host_ids into a workflow variable.
Looping mechanism – Use a Do Until loop to iterate through the array. Each loop iteration picks one host_id.
Nested REST step – For each host_id, make the subsequent REST call to fetch detailed host information.
Transform/Mapping step – Map the returned fields to the CMDB schema.
CMDB update via Reconciliation Engine – Insert/update into cmdb_ci_network_host and cmdb_ci_hardware records, ensuring you specify the correct discovery source and follow Identification & Reconciliation rules to maintain data integrity.
Best practices:
Avoid direct GlideRecord updates on CMDB CIs rather use reconciliation rules.
If the volume of host_ids is high, consider batching to reduce API and workflow execution timeouts.
Found a great resource on IRE: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0750386
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.