Concept of relationship



Trying to my get my head around relationship in schemas? What is the purpose of such relationships? Why follow from one instance to another rather than calling the followed instance? Read the oreliiy book, but not clear. I am not a Ruby programmer but still trying to understand. New to ManageIQ/Clouforms.



Hi @ashok_nair
Relationship is an “arrows” in the “block diagram” of your workflow. For example you have workflow for provisioning a virtual machine. Each relation in the workflow is the call to a particular method (code) to perform shuch tasks as registering machines in the CMDB or DNS. Relationship is only method to call any instance from your running instance elsewhere in the Automation Datastore.


Hi Igor,

Thank you.



Hello @star_night

In Ruby on Rails, they have a concept of has_many:
A Provider has many Hosts.
A Host has many Vms.

Some of these relationships are straightforward while others, like folders, are more complicated.

Relationships allow us to nest many different types of objects together.

Also, fetching an object tree with children and grandchildren can quickly generate many queries. This allows us to bring back all the levels in the tree in an efficient manner. It is tricky since the objects at each level live in different tables.



Hello Keenan,

Thank you. So, looking at the schema for Infra/VM/Provisioning/Profile, it has two fields of type relationship (networks and vmname) with messages “get_networks” and “get_vmname”. Are they called in order when “Profile” class is instantiated or they called from methods of the profile class? Trying to understand the flow. Also, “vmname” relationship has a default value (/Infrastructure/VM/Provisioning/Naming/Default#create) and networks dont have a default value. Can you please explain the flow of execution? And how are “collect” fields used.

Is there any documentation that I can read to better understand all these?

Thank you for your time.



It sounds like the automate book might be useful. The “official” O’Reilly version is a free download here:

There’s a slightly updated version here: that covers some of the Ansible integration.

Hope that helps,


Hello Peter,

Thank you. Read the book once, although skimmed through some sections. Will go back and read again. From the “Event Driven Automation” section I understand that these instance methods are run sequentially using the “Default” value. Is that a correct? What happens when there are no “Default” values as in the case of “networks” relationship. I think “collect” fields are a means to return a value back to the “root” object? I could be completely off here.

Thank you for writing the book. Back to the book…



I followed the example of “a more advanced example” in the book and concluded that the relationship methods are called in sequence as they appear in schema using the value of the “value” field. What will be the flow when the “value” field is empty? Still the question remains on usage of “collect” fields.


Collections and messages are described in the chapter “More Advanced Schema and Instance Features”. The relationships in the schema are filtered by the message used when the instance is called. The default message is ‘create’, so if one isn’t specifically added to the called URI, #create is appended.

So in your example of the profile instance, it’s generally called using a specific message, for example:


All of the schema fields that specify this message will be called in the order that they appear in the schema. In the case of the profile instance only one entry has that message, so that’s all that gets run.

The collect column propagates an attribute defined in a called method up to the caller, or to $evm.root.



Awesome. Thanks.

Is the github version available for purchase anywhere? That would be my “2 cents” back to the community.


No, it’s all free :slight_smile:


Thank you ( with a sense of guilt )