How to display "country" field value from cmn_location table in custom field of "LIST" type?

abhi710
Tera Contributor
 
7 REPLIES 7

Sumanth16
Kilo Patron

Hi @abhi710 ,

 

try this in Before BR

(function executeRule(current, previous /*null when async*/ ) {

var groups = current.u_groups; //0f9881b02f612010501d9bacf699b67c , b6a8cd702f612010501d9bacf699b6b1

var arr = [];

var gr = new GlideRecord('cmn_location');
gr.addQuery('nameIN'+ current.getValue("u_groups"));//change to your field name
gr.query();
while (gr.next()) {
       arr.push(gr.getValue("sys_id"));
}


current.u_assignment_group = arr;// change u_assignment_group to your field name
gs.log('test u_assignment_group ' + current.u_assignment_group);//change the log statement

})(current, previous);

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

Thanks & Regards,
Sumanth Meda

 

Kishor O
Tera Sage

Hi @abhi710 ,

Can you elaborate on your requirement a little more?

abhi710
Tera Contributor

Hi @Kishor O ,

There is a custom field "Country" of type "List" on custom table, which refers to the cmn_location table. The country name should be displayed in the LIST collector from cmn_location table. How can we achieve this without changing the display value of cmn_location table?

Andrew_TND
Mega Sage
Mega Sage

Hi @abhi710 

From what I'm reading do you want to add country from the cmn_location which is held on a custom table? Why do you want it in a list? Surely you're location is only going to be in one country?

Thanks Andrew