Use system property in Module arguments

Maros2
Kilo Contributor

Hello All,

I have an issue with using system property in module arguments. 

Module link type is URL and argument is:

kb_feedback_list.do?sysparm_query=article.cmdb_ciINjavascript:new ScriptName().getServices(gs.getUserID());

This script include is client callable and works fine for admin. However not for other users. After debugging I have realized that the issue is with system property. Since this is client callable, I do not think I can use gs.getProperty so I have built method to do that:

getSystemProperty: function (propName) {
		var gr = new GlideRecord('sys_properties');
		var value;
		
		gr.addQuery('name', propName);
		gr.query();
		
		if (gr.next()) {
			value = gr.getValue('value');
		}
		
		return value;
	}

Does it mean that if user doesn't have access to sys_property table he cannot get it via script either? Another thing I have tried is to add property to method argument like so:

kb_feedback_list.do?sysparm_query=article.cmdb_ciINjavascript:new ScriptName().getServices(gs.getUserID(), gs.getProperty('property.name'));

But this does not work for anyone, not even admins. Which seems weird that I can call gs.getUser here but not getProperty. 

How can I solve this issue? I do not want to hardcode property value into script. Thank you.

6 REPLIES 6

The script that you are showing is a script include that is client callable correct? If yes, that is not a client-side script. You can use getProperty function in a script include.

It works if I call script include from Scripts - Background it is fine. However from Module url it does not. Is there any other way to get property there?