Use getProperty in URL (from Arguments) not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2019 03:27 AM
Currently we have a module linking to our catalog home page, using URL (from arguments) type and the following argument code: catalog_home.do?sysparm_catalog=5a281eaa1b736740ba4eea0f6e4bcbb3
This is working fine, but I would like to replace the hardcoded sys_id in the URL and use getProperty function. With this purpose, I've first created a system property called default.catalog to store the catalog sys_id.
Then I've created a very simple script include:
Finally I've replaced module URL argument code: /catalog_home.do?sysparm_catalog=javascript:getDefaultCatalogID().getid()
But this is not working, as when I click on the module it takes me to following URL:
What I'm missing here? Any idea?
Thanks in advance!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2019 03:37 AM
create classes script include .
sample steps :
url :
sys_user_list.do?sysparm_query=user_name=javascript:getDupUsers()
classless script include.
function getDupUsers() {
var usernames = [];
var grUser1 = new GlideRecord('sys_user');
grUser1.addActiveQuery();
grUser1.addNotNullQuery('user_name');
grUser1.query();
while (grUser1.next()) {
var username = grUser1.user_name.toString();
var grUser2 = new GlideRecord('sys_user');
grUser2.addActiveQuery();
grUser2.addNotNullQuery('user_name');
grUser2.addQuery('user_name', '=', grUser1.user_name);
grUser2.query();
var len = grUser2.getRowCount();
if (len > 1) {
usernames.push(username);
}
}
return usernames;
}
Note: same way you can design it for your requirement. hope sample code will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2019 12:13 AM
Hi Harshvardhan,
I've used your sample code to compose mine as follows:
function getDefaultCatalogID() {
var sys_id = gs.getProperty('default.catalog');
return sys_id;
}
Then call it from the URL Module argument field like this:
/catalog_home.do?sysparm_catalog=javascript:getDefaultCatalogID()
But it didn't work 😞