user table record gives Invalid update error

vinod6
Tera Contributor

I am trying to deactivate a user record in the sys_user table, but it is showing an 'Invalid update' error, even though all mandatory fields are filled. Please provide the root cause for this.
Thanks!

4 REPLIES 4

Roshnee Dash
Tera Guru

Hi @vinod6 
Can you share what error are  you getting?

Your feedback makes the community stronger! If you found this helpful, marking it as the correct answer helps others.
Stay awesome,
Roshnee Dash

Ankur Bawiskar
Tera Patron
Tera Patron

@vinod6 

how are you deactivating?

From form or list?

share screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Gaurav Shirsat
Mega Sage

Hello @vinod6 

Please try this in sub PROD Instance first in Background Script.

 

var user = new GlideRecord('sys_user');
user.addQuery("sys_id","");//paste the sysID of the user
user.query();
while(user.next())
{
// check whether you are getting correct user or not
gs.print(user.name);

}


if you find correct user then run below code
var user = new GlideRecord('sys_user');
user.addQuery("sys_id","");//paste the sysID of the user
user.query();
while(user.next())
{
user.setWorkflow(false);
user.setUseEngines(false);
user.active=false;

user.update();

}

 

Some Debug you can check as:

ACL :

 

  • Go to System Security > Access Control (ACL).

  • Look for sys_user.* or sys_user.active ACLs.

Business Rule:

 

  • Go to System Definition > Business Rules and look for ones on the sys_user table.

  • look for Before or Async rules that have logic to prevent updates or throw errors.

 

 

Thanks and Regards

Gaurav Shirsat

kaushal_snow
Mega Sage

Hi @vinod6 ,

 

Please go through this Now support KB article: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0529860

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/