- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 11:35 AM
Hello Guys,
I'm facing some issue to run a background script to update some fields in the CMDB CI table, the problem is that we have other fields that are mandatory in this form and also, we have a lot of empty data in these mandatory fields (I think this was caused by an import from the old system to ServiceNow, some of the fields are empty today but they should have data and they are mandatory).
So, when I try to run a background script to update two or three of these fields, I've got an error saying the others are mandatory:
Background message, type:error, message: Data Policy Exception: Operating System is mandatory , OS Service Pack is mandatory , Asset Ownership is mandatory , Part Number is mandatory , Warranty expiration is mandatory
Background message, type:error, message: Data Policy Exception: Part Number is mandatory
My question is: Is there any way to run the script, update the fields I need and ignore the ones that is empty and are mandatory?
Thanks!
Milton P. Silva Junior
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 12:48 PM
Check out what Data Policies (System Policy \ Data Policies) you have configured and you could temporarily deactivate them, run the script then activate them once again? You can minimize the possibility of someone else updating records without the Data Policies being active if you do this after hours, which I would highly suggest anyways.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 12:19 PM
Have you tried using the setWorkflow method:
http://wiki.servicenow.com/index.php?title=GlideRecord#setWorkflow
http://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
I'm not 100% sure if it will stop the data policies from running or not. If not, there's a "new" method called setUseEngines that may help - http://wiki.servicenow.com/index.php?title=GlideRecord#setUseEngines. I say new because I've never seen it before and do not know when it was introduced, so you may not even have access to it, depending on the version of your instance.
As always, when running Background Scripts, be very careful and try it out in a development instance first
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 12:41 PM
Hi Jim,
Thanks for your answer, I've tried your suggestions but unfortunately they did not work, I'll keep searching for an answer if this is possible.
And sure, I'm doing all of this in our Dev instance!
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 12:48 PM
Check out what Data Policies (System Policy \ Data Policies) you have configured and you could temporarily deactivate them, run the script then activate them once again? You can minimize the possibility of someone else updating records without the Data Policies being active if you do this after hours, which I would highly suggest anyways.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 12:57 PM
Yes, actually this is the simple way, I thought there were a lot of Data Policies but there is only one, I deactivated it and it works!
Thanks Jim, I'll try to make those changes this way!