How to query a table

ganesh7
Kilo Contributor

Hello Experts,

I have a table with 3 columns

Group

Support Email

Urgent Email

I want to Query the table based on Group i need to set the remaining two fields (Support n Urgent)

For ex if Group is hr, i want hr.support@xx.net and hr.urgent@xx.net in corresponding fields...

it is possible through glide query, so which condition i need to write here.

Can you please give some idea.

Regards,

Ganesh.

14 REPLIES 14

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Ganesh,



You can write a before BR and fetch the value of group like


var grp =current.u_group.name; //This will give group name selected.Here I am assuming u_group is the column name of the field.



Based on this value you can set the other fields like


current.u_support_email = 'hr.support@xx.net';


Hi Pradeep,



var group=new GlideRecord('u_team_vanity_emails');


group.addQuery('u_squad',squad);


group.query();


if(group.next() && group.squad != ' '){


  current.u_support_email=xx;


  current.u_urgent_email=xx;


}



U mean like this, If i did like this in assignment group i need to select different different groups right?


so that time also this should work.?



Regards,


Ganesh.


What is squad here and is u_squad a reference field?


Also group.squad   should be group.u_squad


Hi Pradeep,



sorry for confusion, The fields under the table is Squad, Support Email, Urgent Email.