The CreatorCon Call for Content is officially open! Get started here.

How do I get related list record through script?

Rajanmehta
Mega Guru

Hello,

I am trying to get related list REQ record from Interaction table via script. Can someone please advise how do I get that?

I tried below code but doesn't work. 

var x = new GlideRecord('interaction');
x.addQuery('number','IMS0000623');
x.query();
gs.print(x.getRowCount());

if(x.next()){
var y = x.getValue('task');
gs.print(y);
}

Thanks.

find_real_file.png

 

12 REPLIES 12

Hello Ankur,

When I look at the corresponding REQ record I see interaction tab in the related field list but I don't see any value, but on REQ table I see the Parent Interaction as reference field. (Second screen shot)

 

find_real_file.png

 

find_real_file.png

Hi Rajan,

So in your REQ table record is interaction value populated?

if it is populated then only it will be shown in the related list

Please add some interaction value in that parent_interaction field on REQ for REQ0338030 and then check

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I am not seeing any values on REQ table. I see it only on Interaction related list tab as I showed in my earlier snap shot. 

I believe we might have to create a view to combine both table. Your thoughts !! 

Thanks,

Rajan 

 

 

 

 

Hi Rajan,

please try populating the IMS interaction record into the parent interaction field of REQ  and save it

Once saved the IMS record would be shown in the related list of Interaction on the REQ form

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

The whole idea is to get the contact type from Interaction and transfer it to corresponding Request. We have some historical data which need some rework on Contact type.