Can't use gs.getProperty to set default on a reference field

Tony Flower
Tera Contributor

We have a field of type reference on the table of a scoped app.  We'd like to set a default value for new records and use a system property in order to avoid hard coding the default value as the default is effectively pointing to a data record.

 

When we attempt to use getProperty on the default attribute in the dictionary, it gives the following error:

 

Screenshot 2023-04-13 at 13.32.33.png

 

Some ServiceNow scoped applications use gs.getProperty to populate default values so it's not clear why it's not working here.  Any ideas?

1 ACCEPTED SOLUTION

Try to check use Dynamic Default

View solution in original post

8 REPLIES 8

Anurag Tripathi
Giga Patron

if you run the same thing in a background script, can you print the property?

Yes - background script reads the property ok

 

Screenshot 2023-04-13 at 14.40.10.png

 

Looks like the cross scope privilege was inserted now, see fi the default things works now?

Yes, issue is still there.  The form for the dictionary entry gives an error when I try to use the javascript gs.getProperty call to set the default value.