workflow script activity - conditional based approavl - vancouver

levino
Giga Guru

Hi  there

 

i have a cat item with a free text field where users type in mailbox email address.

i have also created in the sys_user_group table,   with the mailbox email address.

 

how do i trigger  a group approval to the relevant group for approval.

 

e,g  if user type in   fireandemergency@yahoo.com  it checks the sys_user_group table and then triggers approval to the relevant group

 

can it be just 1 if script with a dynamic approval group based on the conditions above?

 

Thanks

Levino

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Kavita_Bhojane
Tera Guru

Hi @levino ,

 

You need to write this script in "Approval - Group" activity as per attach snapshots:

var answer = [];
var grp = new GlideRecord('sys_user_group');
grp.addQuery('email'current.variables.email_address); //free text field where users type in mailbox email address
grp.query();
if(grp.next()){
answer.push(grp.sys_id);
}

 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Kavita Bhojane

 

View solution in original post

Kavita_Bhojane
Tera Guru

Hi @levino 

 

Thank you for acknowledging my response as helpful.

If my assistance proved beneficial, please mark it as correct and close the thread to benefit future readers.

 

Regards,

Kavita Bhojane

 

 

View solution in original post

5 REPLIES 5

Kavita_Bhojane
Tera Guru

Hi @levino ,

 

You can use Approval - Group activity and write below script in advanced section:

 

var answer = [];
var grp = new GlideRecord('sys_user_group');
grp.addQuery('email', current.variables.email_address); //free text field where users type in mailbox email address
grp.query();
if(grp.next()){
answer.push(grp.sys_id);
}

 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Kavita Bhojane
 
 

naveen14
Kilo Guru

Hello @levino 

 

var answer =[];

var gr = new GlideRecord("sys_user_group");

gr.addQuery("email","fireandemergency@yahoo.com");

gr.query();

if(gr.next()){

answer.push(gr.getUniqueValue());

}

 

If this code is helpful, please click on Thums up button.

Hi Naveen

thank you for your response,  so in the workflow , this script goes in the run script activity- then the output to the  group approval activity ?

or do i put this code group approval activity itself by clicking on adavanced

 

Thanks

Levino

 

 

Kavita_Bhojane
Tera Guru

Hi @levino ,

 

You need to write this script in "Approval - Group" activity as per attach snapshots:

var answer = [];
var grp = new GlideRecord('sys_user_group');
grp.addQuery('email'current.variables.email_address); //free text field where users type in mailbox email address
grp.query();
if(grp.next()){
answer.push(grp.sys_id);
}

 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Kavita Bhojane