I want to print the deactivation date when the User is inactive in Firm

Pooja Khatri
Tera Contributor

Hello All , 

 

I have a requirement where whenever the user  becomes inactive (which means user is marked as active = false) in ServiceNow it should print that date when the user was marked as active = false in the 'Deactivation Date' field which is on the 'sys_user' table . 

 

How can I implement this functionality  ? 

 

 

2 ACCEPTED SOLUTIONS

saran4
Kilo Guru

BR condition after update active chnages to false

 

var gdt  = new GlideDateTime();

current.setValue("u_deactivation_date",gdt);

current.update();

 

if helpful

Mark as helpful

View solution in original post

Sumit Singh
Tera Expert

Hi @Pooja Khatri 
You can try this
Create a BR on sys_user table like this

 

brs.pngbr.png

View solution in original post

5 REPLIES 5

Vasantharajan N
Giga Sage
Giga Sage

Option 1: You may try enable field level audit on sys_user table for the field active.

Option 2: Have custom DateTime field to manage the Account Deactivation DateTime. 


Thanks & Regards,
Vasanth

Hi @Vasantharajan N - I am trying to write a BR on the sys_user table which will run when the condition will be active changes to false .. what should I write in the script part to print the 'deactivation date' which is a field in the user table to print the current date when active changes to false .

Hi,

If you just want to have a log when the user  becomes inactive,

"Activity Log" is the easiest way.The link below shows you how to do it .
https://servicenowscholar.com/2019/07/30/add-activity-log-to-a-form/

 

 

If you want to have a field to manage the Account Deactivation DateTime,

You need to add a field to the sys_user table( or add a new table which implements the sys_user table )  and then write a br like this.

when to runwhen to runset valueset value

 

 

 

 

 

 

Please mark my answer as correct and helpful based on Impact.

saran4
Kilo Guru

BR condition after update active chnages to false

 

var gdt  = new GlideDateTime();

current.setValue("u_deactivation_date",gdt);

current.update();

 

if helpful

Mark as helpful