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

RKumar3
Tera Guru

Hi Maros,
Yes its true that if a user does not have access to a table, he/she can not retrieve it via code as well. I would suggest to use a display business rule on kb_knowledge table and pass the property in scratch pad and try using the same scratchpad variable in URL.

Business Rule:
g_scratchpad.my_property = gs.getProperty('propName');

Try g_scratchpad.my_property in URL

Hope it helps.


Regards,

Rajnish

Maros2
Kilo Contributor

Hi, I have tried this and it does not work. What setting should display business rule have to be able to use scratchpad in Module argument? 

Kalaiarasan Pus
Giga Sage

So why exactly are you not using gs.getProperty to read the property in your script? Why are you using a gliderecord here?

As per community question:

"You cannot use gs.getProperty() client-side..."

 

Of course I have tried it, but it does not work.