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

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Have you tried dot walking to the Active field on the user table from the Owned by user reference field on the CI.

 

If Owned by.active == false in the condition builder?

How to set up in the email notification condition as ownedby.active == false?

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

Nirosha Uddandi
Kilo Guru

In condition filed scroll down and click on show related fields-->check for owned by->user fields, click on that and again in drop down you will find active option