Comments on: Working with System Properties https://servicenowguru.com/system-definition/working-with-system-properties/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 20:48:16 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Mark Stanger https://servicenowguru.com/system-definition/working-with-system-properties/#comment-10031 Fri, 24 May 2024 19:32:31 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-10031 In reply to Todd.

Done! Thank you!

]]>
By: Todd https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7741 Tue, 16 Aug 2022 13:51:57 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7741 Consider fixing your links to wiki.servicenow.com.

]]>
By: David https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7739 Wed, 18 Jan 2017 03:10:53 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7739 In reply to Mark Stanger.

It appears that I can hit sys_properties table with REST. This works, but I haven’t yet discovered the security ramifications. These properties were created within the same application scope so maybe that has something to do with success so far:

$scope.query = ‘?sysparm_query=name%3Dx_kasc_ev_charging.session.length&sysparm_fields=name%2Cvalue’;
$scope.url = ‘/api/now/table/sys_properties’ + $scope.query;

//CALL TO REST SERVICES (angular)
//———————
$http({
method:’GET’,
url:$scope.url,
transformResponse: undefined}).then(function(response) {
console.log(response.data);
$scope.data = angular.fromJson(response.data);
console.log($scope.data[‘result’][0].name);
}).catch(function(response) {
console.error(‘Error’, response.status, response.data);
})
.finally(function() {
console.log(“All Done”);
});
//———————

CONSOLE OUTPUT:

{“result”:[{“name”:”x_kasc_ev_charging.session.length”,”value”:”2″}]}
x_kasc_ev_charging.session.length
All Done

]]>
By: Mark Stanger https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7738 Wed, 18 Jan 2017 02:14:10 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7738 In reply to David.

Hey David, It doesn’t surprise me that scoped apps have made this more difficult. I’m not sure off the top of my head what an alternative solution would be but if I think if anything I’ll let you know.

]]>
By: David https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7737 Wed, 18 Jan 2017 01:48:59 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7737 Mark, do you have an example of how to do this in a scoped app? It seems there are many hoops to jump through with a GlideAjax approach and it looks like via the REST API explorer the sys_properties table is not available. Stumped….

]]>
By: Mark Stanger https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7736 Wed, 18 Feb 2015 15:13:41 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7736 In reply to Sherwin Ghavam.

Nice catch! I’ve corrected the code above.

]]>
By: Sherwin Ghavam https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7735 Wed, 18 Feb 2015 15:11:09 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7735 in the script there is a small error. line if(rec.next(){ missies a ) so the actual line: if(rec.next()){

Complete script would be:
var rec = new GlideRecord(‘sys_properties’);
rec.addQuery(‘name’, ‘your.property.name.here’);
rec.query();
if(rec.next()){
var yourPropertyValue = rec.value;
}

or:
var rec = new GlideRecord(‘sys_properties’);
rec.addQuery(‘name’, ‘your.property.name.here’);
rec.query();
if(rec.next()) var yourPropertyValue = rec.value;

]]>
By: Mark Stanger https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7734 Thu, 03 Feb 2011 07:15:24 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7734 In reply to Alain.

You’re correct. the ‘get’ method only works client-side if get based on the sys_id of the record. To query using name (or any other attribute) from the client, you need to use the full GlideRecord query syntax. I’ve updated the client script section above to reflect this change.

]]>
By: Alain https://servicenowguru.com/system-definition/working-with-system-properties/#comment-7733 Thu, 03 Feb 2011 02:49:01 +0000 https://servicenowguru.wpengine.com/?p=2146#comment-7733 Hi there,

It seems that doing:

var rec = new GlideRecord(‘sys_properties’);

rec.get(‘name’, ‘your.property.name.here’);

in a Client Script does not work anymore… :-(

Alain

]]>