How to get a field from a related list

d-aizawa
Kilo Sage

I created a Factor Type field in the Problem table.

Factor Type
Table : problem
Type : String
Column name : u_factor_type
Choice value

  • internal_factor
  • external_factor
  • other

I want to see the fields below to auto-set the Factor Type field choices

Damage
Table : cmdb_ci_outage
Type : String
Column name : u_damage
Choice value

  • having
  • nothing
  • other

Is there a way to get the information of the Incident record
from the related list of the Problem record and then the fields of the Outage record?

Thank you

find_real_file.png

find_real_file.png

find_real_file.png

 

1 ACCEPTED SOLUTION

Hi,

This is how you can get the outage related with problem.

var incGr = new GlideRecord('incident');
incGr.addQuery('problem_id',current.getUniqueValue());
incGr.query();
while(incGr.next()){
var outageGr = new GlideRecord('cmdb_ci_outage');
outageGr.addQuery('task_number',incGr.getUniqueValue());
outageGr.query();
while(outageGr.next()){
gs.info('Damange :'+outageGr.u_damage);
}
}

 

Here current refers to the problem record.

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

8 REPLIES 8

Anil Lande
Kilo Patron

Hi,

What is problem have multiple incidents and incidents have multiple outage records?

 

Thanks,

Anil Lande 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Where you want to access it? in client side script or server side script?

How you want to use it on problem?

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi.

I'm sorry it's hard to understand.

In other words, I would like to know how to get the Outage record from the Problem table.

Currently, the Problem table and Outage table are linked only to the related list.

How to open from Problem to Outage.

Problem Related list : Incident tab > Incident Related list : Outages tab > Outage record

Thank you.

Hi,

This is how you can get the outage related with problem.

var incGr = new GlideRecord('incident');
incGr.addQuery('problem_id',current.getUniqueValue());
incGr.query();
while(incGr.next()){
var outageGr = new GlideRecord('cmdb_ci_outage');
outageGr.addQuery('task_number',incGr.getUniqueValue());
outageGr.query();
while(outageGr.next()){
gs.info('Damange :'+outageGr.u_damage);
}
}

 

Here current refers to the problem record.

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande