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.

Change property value from other application scope

David Berdasco
Tera Contributor

Hi,

¿Is possible to change the property values of a custom scoped application from another custom scoped application?

For example, I have:

  • A custom scoped application, Test, with a property: test.my_property
  • A second custom scoped application, Test2
  • Both of them with ‘Tracking’ as Runtime Access Tracking.

Now, I go to the Scripts – Background and, with the Test2 scope selected, run:

gs.setProperty("test.my_property", "new value!");

But It doesn’t work:

Security restricted: Execute operation on API 'Glide API: properties' from scope 'Test2' was granted and added to 'Test2' cross scope privileges

Security restricted: Access to property 'test.my_property' from scope 'Test2' has been refused due to the property's cross-scope access policy.

So, I try to create the cross scope privilege:

  • Source Scope: Test2
  • Target Scope: Test
  • Target Name: sys_properties
  • Target Type: Table
  • Operation: Write
  • Status: allowed

But without success:

Security restricted: Access to property 'test.my_property' from scope 'Test2' has been refused due to the property's cross-scope access policy.

 

¿Suggestions?

Thanks in advance!

1 ACCEPTED SOLUTION

Andrew Barnes -
ServiceNow Employee
ServiceNow Employee

Greetings David,

 The system properties table itself prevents the cross-scope write operation. You would have to change the application - all scopes - write option on the table to directly get around this. To indirectly get around this, you can in your Test application make a 'setProperty' api available to other scopes. 

-Andrew Barnes
Join me at Developer Blog

View solution in original post

2 REPLIES 2

Andrew Barnes -
ServiceNow Employee
ServiceNow Employee

Greetings David,

 The system properties table itself prevents the cross-scope write operation. You would have to change the application - all scopes - write option on the table to directly get around this. To indirectly get around this, you can in your Test application make a 'setProperty' api available to other scopes. 

-Andrew Barnes
Join me at Developer Blog

Thanks Andrew!

 

Changing the write option on the table sys_properties still doesn't work (still raises the cross-scope message). But indeed this approach doesn't seem us the best one, so we use your indirect solution and it works fine.

 

Best regards