Discovery Pattern Step-Create Relationship not happening

SNowUser11
Kilo Guru

Hello Experts,

I was looking to create relationship between a cmdb_ci_computer and cmdb_ci_service Using relation Depends On:: UsedBy

cmdb_ci_computer table contains a field u_service which is same as cmdb_ci_service table. Eg:

On Table cmdb_ci_computer

--------------------------------

Name                 u_service(String field) getting this via Discovery

COMPUTER1      Acrobat

 

On Table cmdb_ci_service 

-------------------------------

Name

Acrobat

 

Then on Table 'cmdb_rel_ci' want to create a relation

Parent             Type                            Child

Acrobat            Depends On::UsedBy     COMPUTER1

It does not give me error but does not create result when i do TEST . Any step I am missing please guide.  Thanks

find_real_file.png

 

30 REPLIES 30

Do not want reference for now Only relation for now so I am not checking the reference checkbox

SiD2
ServiceNow Employee
ServiceNow Employee

Hi @SNowUser11,

I believe you are doing this in Desktop pattern in a new extension section and not Identification section.

Also I guess the cmdb_ci_service is not populated in the server pattern, it should have been already existing in CMDB, if this is the case, it is not possible to create a relation through pattern.

Please confirm above things to assist you further.

Please mark Helpful / Accept Solution so that it helps others with similar questions.

Hi Sid,

Yes I am doing in Windows OS-Desktop pattern. Thats right discovery is not populating the cmdb_ci_service but when I was going through OOB steps in Discovery section there are many relationships build and what I saw is before building relationship if there can be a insert to that table might be possible. Example serial number ,network adapter etc not sure if that understanding is correct

Also I quite not sure what I did is I created another STEP before Create Relationship to insert the Service Value (Adobe) into the cmdb_ci_service.name

HOping that here pattern will consider the cmdb_ci_service table . When I test in debug get the relationship but when i run discovery it does not create relationship actually. 

So not sure if that should work because still i am discovering (Adobe) via discovery but as string in cmdb_ci_computer as said in my POST .

Any thoughts please highly appreciated if this should work?

Thanks

SiD2
ServiceNow Employee
ServiceNow Employee

Hi @SNowUser11,

Thanks for confirming.

So as you are trying to make a relation with existing CI record in cmdb_ci_service table, this is not supported through pattern.

The trial you did adding the cmdb_ci_service in the existing pattern is not appropriate as you already have a record in this table. If your cmdb_ci_service record also comes from the same discovery then only you can create relation through pattern.

 

So for your case, you can do this in the post sensor script. Add a new post sensor script and you will have access to the payload. In payload you can find the details of cmdb_ci_computer CI and you can check u_service this also will be available.

All you need to do is using cmdb_ci_computer.u_service you have to query the record from cmdb_ci_service table and get the proper sys id of the record. As now you have all the sys id's you can create a relation entry in cmdb_rel_ci in the same script.

 

Please mark the appropriate responses as Correct/Helpful so that this thread gets closed and helps others with the same question in the future.

Please mark Helpful / Accept Solution so that it helps others with similar questions.