Accessing records in a related list

joaosantos
Mega Expert

Is there any way for me to access the records in a specific related list in a script?

5 REPLIES 5

vinitha3
Tera Guru

Yes, you can gliderecord it in a client script or a business rule when ever you want to updte the related list.


But, can you provide more details on your requirement?



Thanks,


Vinitha.K


I have table A that has a field that references table B. In this table there is a related list (Rel) with records from table C. I need to access the records in Rel in a script that runs in table A


parvinder2
Tera Expert

You can write business rule and compare parent to with your current sys id and fetch the related list record.


objname.addQuery('parent', current.sys_id);



Please provide more information, if you looking for any specific requirement.  


joaosantos
Mega Expert

This is the code that i have created but still not working as intended



function ChangeRequestChoice() {



  var rel = new GlideRecord('u_m2m_customer_ser_service_agre');


  rel.addQuery('u_service_agreement',current.u_service_agreement.toString());


  rel.query();


  var aux = [];



  while(rel.next()){


  gs.log('customer sys_id: ' + rel.u_customer_services.toString(),'Oprah');


  aux.push(rel.u_customer_services.toString());


  }



  return (aux.indexOf(current.getUniqueValue()) != -1);


}