Unable to set system properties programmatically via Script Includes

nikhilz
Tera Contributor

I have two custom fields on a Service Catalog Item which are single select dropdowns

 

On load of the create page, a Catalog Client Script is called, which calls a Script Includes script, which calls a third party API to get data to populate the dropdown

 

Some of the data I get, I want to store into system properties. I'm doing that in the script includes as below. A system property with foo already exists and has been created manually

gs.setProperty("foo1", "bar1");
gs.setProperty("foo2", "bar2");

 

This is working fine on the source instance but when I export this as an updateset and import it to another developer's instance, I see the below error

 

Untitled.jpg

 

I was logged in as admin in the source instance as well as the destination instance (where the update set was imported)

Both the instances were Utah

 

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@nikhilz The properties you are trying to update might be private properties hence the system is not allowing you to update them via update set. Here is a support article from ServiceNow mentioning the same https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0760517.

 

Hope this helps.

Radim Tichy
Tera Guru

Hi @nikhilz ,

there might be number of reasons:

- second instance has some different ACL configuration?

- might be also cross-scope issue?

- does the user has sufficient provileges on other instance?

- ... and many others

 

I would recommend you to simply debug you client script and script include where for sure at least on a app logs on specific app node where the transaction is executed should be clearly visible why this is happening.

 

Nevertheless - I would not update any system property with this kind of information.

How frequently could potentially be that catalog item opened - displayed?

How many users are on that instance concurrently working?

Updating system properties in this way could come potentially with performance issues on that instance.

 

Kind regards

Radim