Jump to content
bernie

linkAsset: Entity and relationship types

Recommended Posts

I'm using the linkAsset API call to (yup you guessed it) link entities.

This works well, but I want to be able to query and validate the possible values for the following parameters:

leftEntityType xs:string required once The entity type of the first entity to be linked. (Asset, Request etc)
leftRelType xs:string optional The relationship type of the first entity to be linked. (Connected to, Installed On etc)
rightEntityType xs:string required once The entity type of the second entity to be linked. (Asset, Request etc)
rightRelType xs:string optional The relationship type of the second entity to be linked. (Connected to, Installed On etc)

I did find one possible option for leftRelType 'com.hornbill.servicemanager/RelationshipTypes::get' but that doesn't seem to come back with anything.

I can also see in the schema info:

h_rel_type_l (Left Relationship Type) - The type of relationship in the context of the left item to right item, for example "Installed On", "Connected to", "Depends On", "Child Of" etc

h_rel_type_r (Right Relationship Type) - The type of relationship in the context of the right item to left item, for example "Has Installed", "Connected by", "Used By", "Parent Of" etc

 

Are there API calls I can make to look up valid values or if they're just hard coded, what are they? 

Thanks

 

 

Share this post


Link to post
Share on other sites

Hi Steve,

Thanks for the response.  I've now found I can query these using 'appOptionGet'.

One thing though, upon experimenting with the relationship types it appears I can actually supply anything, whether it's a potentially valid array integer (e.g. '0') or the name 'Connected to', and even something that doesn't actually exist.

The linking still works (no errors) but there doesn't appear to be any difference to how the link appears (using launch explorer).

Should I see a difference in how the links appear or does this relationship type information exist elsewhere?

Thanks

Share this post


Link to post
Share on other sites

Hi @bernie

which entities are you trying to link ?

When we link entities in Service Manager, the UI does not let you choose  the relationship type between the entities (Connected To, ...).

This possibility is provided as an extra by Configuration Manager, which store the info in a different table ''h_cmdb_config_items_dependency'.

The legal values are defined in the app setting 'app.cm.explorer.items.dependencies'

 

Regards

Armando

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Hi ArmandoDM

At the moment I'm looking at the possibilities of linking:

Asset -> Asset

Asset -> Request

Asset -> Service

Whilst investigating the UI activity of these processes I can see that Asset -> Asset sets the relationship type as '1' and '1' (left and right).  With Asset -> Request the left relationship is 'request'.

When you link an asset from within a request via the UI the reltypes (left and right) are set to '-'.

I know that when you use the UI there are no options to specify the relationship.  My assumption is that depending on where you are in the UI and what entities you're linking the XML request reflects this (in other words it's out our control and dealt with automatically).  However, via the API you effectively have free reign as to what you submit within these fields;  it's only validation (whether that's mine or Hornbill's own checks) which will prevent the wrong things being applied.  But RelType doesn't seem to fail or even provide anything as metadata in the UI anyway (at least from what I can see).

So is this purely an aesthetic (information) field?

 

 

Share this post


Link to post
Share on other sites

OK, I've finally had time to look into this further and I've now got the dependency working.

Following what the WUI does when it comes to assigning dependencies using 'data::entityAddRecord' with 'ConfigurationItemsDependency'  I'm able to add dependencies via the API.

A similar configuration can be used to assign the impact using 'ConfigurationItemsImpact'.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...