How to get the parent fields value into the fix script?

Pratiksha_kadam
Tera Contributor

Hi Community,

I have created one field 'Display name' on  'cmdb_ci_business_capabilty' table which shows level and name of capability together. 

I am writing a fix script to change the display of all capabilities, 'Display Name' of a capability where parent is not empty ,The display name should be in below format:

"Display name of parent+ Display name of child".

It means display name works to show the hierarchy of capabilities.

1 ACCEPTED SOLUTION

@Pratiksha_kadam 

You can simply pull by dot walking,
lets say you are declaring the object as grCapability, then your code would be

grCapability.parent.u_display_name //check for the correct backend name of the field

 

Best Regards
Aman Kumar

View solution in original post

5 REPLIES 5

Aman Kumar S
Kilo Patron

@Pratiksha_kadam 

Your query is not clear, could you explain a bit?

Best Regards
Aman Kumar

Pratiksha_kadam
Tera Contributor

I want to show the below result in the 'Display Name' field:

There are two cases, capabilities with parent and without parent.

Capability does not have parent, display name like:

[Level of capability]name of capability

Ex:[L0] Managing Attendance

 

Display Name of capabilities who has the parent:

The field 'Display name' should show like:

Ex:[L0] Manage External Relations -> [L1] Manage Corporate Affairs and Comm

I am able to achieve the 1st case for the second case I need to fetch the display name of parent capability in my code. How can I fetch the parent capability 'Display name' value in fix script?

 

@Pratiksha_kadam 

You can simply pull by dot walking,
lets say you are declaring the object as grCapability, then your code would be

grCapability.parent.u_display_name //check for the correct backend name of the field

 

Best Regards
Aman Kumar

Manmohan K
Tera Sage

Hi @Pratiksha_kadam 

 

Lets assume gr refers to a child capability then you can access parent display name as shown below

gr.parent.getDisplayValue();