Need to change user to active false using background script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2024 06:37 AM
Hi Team,
I need to change user active false using background script. I am using below script, but record of user is not changing to active false.
var gr = new GlideRecord('sys_user');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2024 07:01 AM
@Vyanktesh08 Active field should be set boolean (true/false) and sys_id is right field , please try below script:
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', '62826bf03710200044e0bfc8bcbe5df1');
gr.query();
if (gr.next()) {
gr.active = false; // Set as boolean
//gr.setWorkflow(false); // Disable workflows if you don’t want it to trigger any
gr.update();
}
Hope this will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2024 07:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2024 09:35 AM