How to get the selected record field values in LIst UI action

Saranya Suresh
Kilo Expert

HI There!

I need to create a List UI action button for doing the below activity.

1. I should be able to compare all the selected records for thier delivery location, if the selected records have same location, then i should display error message.

2. I have achieved till getting the selected records sys id using g_list.checked(). But am trying to query that record using glideRecord method which is not working.

I have written the below client checked UI action. Please help me in with this and what needs to be done for this.


selSysIds = g_list.getChecked();

sysIdList = selSysIds.split(',');
alert('status - '+selSysIds);

for (var i=0;i<=sysIdList.length;i++)
{
alert('i is '+i);
alert('sys id is '+sysIdList[i]);
var a = "'"+sysIdList[i]+"'";
alert('a is '+a);
var gr = new GlideRecord('proc_po_item');
gr.addQuery('sys_id',a);
gr.query();
gs.addInfoMessage('rec ret '+gr.getRowCount());
if(gr.next()){
gs.addInfoMessage('no is '+gr.number);
}
}


if(typeof window == 'undefined')
serverReopen();

function serverReopen(){
}
}

 

 

6 REPLIES 6

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

 

Use gr.addQuery('sys_id','IN',a);

 

Thanks,
Ashutosh Munot

Saranya Suresh
Kilo Expert

Hi Ashutosh,

Its not working..still the same..

Try this:

 

gr.addQuery('sys_id',sysIdList[i]); And remove a

 

Thanks,
Ashutosh Munot 

Saranya Suresh
Kilo Expert

Thanks for your suggestion. I have just written a Script include in UI action and am ale to achieve it.

Thanks.