- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2022 11:51 PM
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 ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:22 AM - edited 11-24-2022 01:24 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 12:28 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:18 AM
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 02:06 AM
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 run
set value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:22 AM - edited 11-24-2022 01:24 AM
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