List using Module Arguments

Mike Formica
Kilo Expert

I'm not understanding how to use Module Arguments.  I am looking to create a menu item(module) that lists certain cases based on a script include that i built.  Currently the script include is set to return the sys_id's of the cases need.  

If you run this: 

var caseNums = new sn_hr_core.CaseUtils().unassignedMultiDepartment();
gs.info(caseNums);

It returns:

** Script: 65847142dbfa9410d9692a591396190f,3b94b142dbfa9410d9692a59139619cd

These are the exact cases that I'd like to see in the list view.

These are the arguments however this does nothing at all.

find_real_file.png

Any ideas?

Thanks!!!
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Mike Formica 

points to mention:

1) Script include should be client callable

2) call it like this

/incident_list.do?sysparm_query=sys_idINjavascript:new getRecordsAjax().getRecordsDefault()

In your case it would be something like this

/sn_hr_core_case_list.do?sysparm_query=sys_idINjavascript:new sn_hr_core.CaseUtils().unassignedMultiDepartment()

Example below: give your table name; I have taken example for incident table

Link type - url from arguments

Arguments -

/incident_list.do?sysparm_query=sys_idINjavascript:new getRecordsAjax().getRecordsDefault()

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ruhi Jibhyenka1
Mega Guru

Hi Mike,

script include has created in scoped application ?

if yes then add scope before the script include 

example:

&sysparm_fixed_query=company=javascript:gs.getUser().getCompanyID()^location.sys_idINjavascript:new <scope>.getmappedlocation().getmappedlocation();

Or in the field 'Link type', select Script(From Arguments).

And try keeping the script include and function name as same and pass the arguments.

Mark correct if my answer has solved your issue and/or helpful if my response was worthy.

Thanks,

Ruhi.

Thanks, this is very helpful.  I changed the link type to Script(From Argument) and updated the argument to:

&sysparm_fixed_query=sys_idINjavascript:new sn_hr_core.CaseUtils().unassignedMultiDepartment();

However, i am getting an error:

find_real_file.png

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Mike Formica 

points to mention:

1) Script include should be client callable

2) call it like this

/incident_list.do?sysparm_query=sys_idINjavascript:new getRecordsAjax().getRecordsDefault()

In your case it would be something like this

/sn_hr_core_case_list.do?sysparm_query=sys_idINjavascript:new sn_hr_core.CaseUtils().unassignedMultiDepartment()

Example below: give your table name; I have taken example for incident table

Link type - url from arguments

Arguments -

/incident_list.do?sysparm_query=sys_idINjavascript:new getRecordsAjax().getRecordsDefault()

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks a ton - this worked for me