How to send a email notification to user who is inactive in the owned by field ?

sukran
Mega Sage

in asset email notification part , needs to trigger a mail if asset recovery changed to upgrade to 'OWNED BY USER'

 

the condition is that , we need to configure 'inactive owned by too , if user is inactive that email trigger needs to return back to sent to event creator

 

now challenge is how to put a condition/script to checck if owned by user is inactive so that it will trigger a mail

find_real_file.png

 

1 ACCEPTED SOLUTION

jyotis_
Giga Contributor

Hi Sukran,

 

Try piece of code mentioned below-

\\Get user's active value

var gr = new GlideRecord("sys_user");

gr.addQuery("sys_id", current.owned_by);

gr.query();

var active;

if(gr.next()){

active = gr.active;

}

 

Hope this is helpful for you

 

Regards

Jyoti Soni

View solution in original post

5 REPLIES 5

Dante Ditan
Kilo Sage

Hello,

 

I think the best option here is to create business rule to check if the owned by is inactive. Then you need to use the eventsqueue functionality.

 

By this you have the control on the parameter you will be using to the recipient.

 

 

in your br you have something like this:

 

if(current.u_inactive_owned.active == 'false'){

var gr = new GlideRecord("sys_user");

if(gr.get(gs.getUserID()){

 

gs.eventQueue('user.view',current,gr.email);

}

}else{

gs.eventQueue('user.view',current,current.u_inactive_owned);

}

 

Thanks 

Dante