move business rule from global to application scope

gflewis
Kilo Expert

I have a business rule on a table that is owned by an application.   The scope of the business rule is global (sys_scope=='global').   How can I change it to application scope?

1 ACCEPTED SOLUTION

Mike Allen
Mega Sage

you can use background scripts to do that:



var br = new GlideRecord('<business rule table>');


br.get('<sys_id of your BR>');



br.sys_scope = '<your app scope>';


br.update();


View solution in original post

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Giles,




You may have need to move changes between global and private application scopes. For example:


  • You want an application created in a prior release to be a scoped application.
  • You want an application inadvertently made in the global scope to be in a private scope.
  • You want an application inadvertently made in a private scope to be in the global scope.
  • You want to move features from one private scope application to another private scope application.


In all cases, you must create a new application in the proper scope and manually move changes to it.


Mike Allen
Mega Sage

you can use background scripts to do that:



var br = new GlideRecord('<business rule table>');


br.get('<sys_id of your BR>');



br.sys_scope = '<your app scope>';


br.update();


I would advise caution around this approach, I don't think it is supported by ServiceNow.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

It's probably not, but I have not seen it cause issues.   Of course, I am the guy always dissecting update sets to get them to exactly what I want, and that isn't supported, either.