Unable to implement lookup record and for each loop on list collector variables in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2023 05:35 AM
I have a record producer with 3 variables:
Base CI List: (Refers to cmdb_ci table) - List collector
Child CI List:(same as above) - List Collector
Relationship Type:(refers to cmdb_rel_type table) - Ref field
Once request is submitted, it will go for an approval and a relationship will be created in cmdb_rel_ci table automatically.
I have implemented this using flow designer. I created a custom action which converts the list of CI record present in base ci and child ci variables in an array of object. Please refer to error logs
Then I used For each item and lookup record and extracted the sys_ids from them:
Child CIs:
Parent CI:
But I am unable to proceed how to create a relationship between the child and parent in cmdb_rel_ci table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2023 05:49 AM
You'll have to nest your for-each loops since you're dealing with two arrays. So if you start with the child, you're saying for each child, interate through the parent(s), and then you can use a create record in the cmdb_rel_ci table for the current child-parent combo inside the nested parent for each loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2023 05:59 AM
I wrote for each first for child as below:
but when I am iterating the second loop for parent by clicking on (+) and trying to add the parent objects in for each, it says, object not allowed
