Scheduled Script Execution

kack l
Tera Expert
Hello everyone
I have an urgent matter. How do I get the content from the sysuser table? The important thing is to get the red part.
 
var A = new GlideRecord('sys_user');
var gr= A.addQuery('company_cd', 'STARTSWITH', '0');
gr.addOrCondition('company_cd', 'STARTSWITH', '1');
gr.addOrCondition('company_cd', '1234567' && 'system_code', '4');
company code1234567 is equal to and system code is equal to 4
 
3 REPLIES 3

Danish Bhairag2
Tera Sage
Tera Sage

Hi @kack l ,

 

Can you elaborate your requirement a little please.

 

Thanks,

Danish

I want to get the users whose company code is equal to 123456 and system code is equal to 4 in the sys user table.

Hi @kack l ,

 

If I understand correctly then its a very straight forward query right. Assuming company code & system code are present on the User Table itself.

 

var gr = new GlideRecord('sys_user');
gr.addQuery('company_cd','123456'); // Please use proper backend value for company code
gr.addQuery('system_cd','4');// Please use proper backend value for system code
gr.query();
while(gr.next()){
gs.info(gr.name); // Add your logic here if you want to do anything with those users
}

 

Please mark my answer helpful & accepted if it helps you resolve your query.

 

Thanks,

Danish