Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

All users are unable to see the newly created field/column in the sys_user table

SN2024
Tera Contributor

Hi,

 

I created a new field on sys_user table called "Deactivated" to record the date and time stamp when the account sets from active to false. I used BR to update the Date and time on the "Deactivated" field.

 

This works and records the date and time but the issue is if I set the account to false, users are unable to see of find the user record that is set to false.

 

Script used for BR:

var gdt  = new GlideDateTime();

current.setValue("u_deactivated_on",gdt);
current.update();

So far I have figuered out this BR is the issue. Can someone please help and suggest what I need to add in this BR so inactive user account who have date and time stamp are visible?
If I deactivate this BR I can see the user accounts
 
Thank you for your help.
11 REPLIES 11

Hi @SN2024 ,

 

Some organizations hide inactive records from end users (other than admins or specific roles), if it was done for the same purpose you need to confirm with your client before deactivating it.

 

Also, this can impact the fields which are referencing user table and don't have a filter active=true, they will start showing all inactive users. 

 

As a workaround, I recommend adding specific roles to this BR (e.g. itil), to show deactivated records to specific role users (fulfillers) who wants to view deactivated records

 

Thanks

Anand

SN2024
Tera Contributor

Hi Anand, all users need to see active and de-active users( in the last 30days) for some catalogue items and I can't figure out the script I can use to achieve this in this BR.

Thank you.

@SN2024 I don't think you can meet your requirement without modifying this business rule.

SN2024
Tera Contributor

Can you please advise what logic I need to add into this BR script

I need to show up active users and deactivated user on last 30 days for some of the catalog items.

 

 

@SN2024 

to show inactive users and still have active OOTB query BR on sys_user check this link and it has approach and tweak

How to get inactive user records in catalog item look up field? 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader