Accessing a global system property from a scoped app

Sue Frost
Giga Guru

I'm adding security to a SOAP call that is created via a UI Action in a scoped application. The SOAP call and Action have been in place for some time.

This code works fine but is, errrr, less than ideal:

//build XML
sm.setStringParameterNoEscape('user_id', 'USERID');
sm.setStringParameterNoEscape('password', 'PASSWORD');
sm.setStringParameterNoEscape('postal_code', pCode);
sm.setStringParameterNoEscape('effective_date', effDate);

This is where I'd like to be:

//build XML
sm.setStringParameterNoEscape('user_id', gs.getProperty('global.soap.userid'));
sm.setStringParameterNoEscape('password', gs.getProperty('global.soap.password'));
sm.setStringParameterNoEscape('postal_code', pCode);
sm.setStringParameterNoEscape('effective_date', effDate);

I would like to put both the user_id and password into system properties. I have no trouble with the 'global.soap.userid' property - it's Type = String property.

However, when the 'global.soap.password' property is set as Type = password or Type = password2, I get an error:

"Access to property 'global.soap.password' from scope 'Extreme Quote' has been refused due to the property's cross-scope access policy."

 

My question is ... how do I configure the Cross-scope record to read a system property? I've tried all the combinations available:

find_real_file.png

 

TIA!

1 ACCEPTED SOLUTION

Sue Frost
Giga Guru

If I needed to have separate IDs/passwords for each scoped application with external calls, creating properties in each application scope would make sense. However, we're using the same ID/password across the platform (at least for now).

To that end, since the system property 'type' of password and password2 don't work, I've taken the easy route and simply set this property as a type of string.

find_real_file.png

That works just fine.

View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sue,

I'm not sure if that is expected behavior or not. As a workaround, you should be able to create those properties in the scoped app and fetch the value.

 

Thanks,

Pradeep Sharma

 

Sue Frost
Giga Guru

If I needed to have separate IDs/passwords for each scoped application with external calls, creating properties in each application scope would make sense. However, we're using the same ID/password across the platform (at least for now).

To that end, since the system property 'type' of password and password2 don't work, I've taken the easy route and simply set this property as a type of string.

find_real_file.png

That works just fine.

Wait, so you just stored the password as plain text? 

How is that a solution? ðŸ¤£