Workflow Studio

ChoudhryA
Tera Contributor

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?

1 REPLY 1

M Iftikhar
Kilo Sage

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:

  1. Initial REST step – Call your endpoint and retrieve the list of updated host_ids

  2. Script step – Parse the response and extract the array of host_ids into a workflow variable.

  3. Looping mechanism – Use a Do Until loop to iterate through the array. Each loop iteration picks one host_id.

  4. Nested REST step – For each host_id, make the subsequent REST call to fetch detailed host information.

  5. Transform/Mapping step – Map the returned fields to the CMDB schema.

  6. 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.