Need to auto populate list of reports based on requestor on the catalog form

cp10
Tera Contributor

Hi Team, I have a requirement to populate list of reports based on Requestor field on the catalog form.

EX- If I have added 'XY' as requestor ...on the name of report field should be populate reports where XY has created the reports.

Requestor -- reference - 'sys_user' table

Name of the report --- reference - 'sys_report' table

 

I tried below script include but its not getting the records on the form, could you please help me on this code.

GetReportlist: function(reqFor) {

                if (reqFor != '') {

                    var reportSysIDs = [];

                    var report = new GlideRecord('sys_report');

                    report.addEncodedQuery('sys_created_by=' + reqFor);

                    report.query();

                    while (report.next()) {

                        var rep = report.title.toString();

                        reportSysIDs.push(rep.toString());

                    }

                }

                return "sys_idIN" + reportSysIDs;

            },

 

 

Field - Referenec qualifier --- javascript: new GetReportSysIDs().GetReportlist(current.variable.requestor);

1 ACCEPTED SOLUTION

Viraj Hudlikar
Tera Sage

Hello @cp10 

 

Why not try simple way as showcase below.


In your "Name of the report" variable just configure it as show below

 

VirajHudlikar_0-1736593897966.png

 

Once this is done what value is selected in Requested Variable as per that selection reports which are created by them will show up in that list.

 

In my case for a user there is only report as below.

VirajHudlikar_2-1736594096626.png

 

Now when I select that user in Requested for variable then in that only same one report is showcased.

VirajHudlikar_1-1736593991186.png


If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.


Thanks & Regards
Viraj Hudlikar.

View solution in original post

1 REPLY 1

Viraj Hudlikar
Tera Sage

Hello @cp10 

 

Why not try simple way as showcase below.


In your "Name of the report" variable just configure it as show below

 

VirajHudlikar_0-1736593897966.png

 

Once this is done what value is selected in Requested Variable as per that selection reports which are created by them will show up in that list.

 

In my case for a user there is only report as below.

VirajHudlikar_2-1736594096626.png

 

Now when I select that user in Requested for variable then in that only same one report is showcased.

VirajHudlikar_1-1736593991186.png


If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.


Thanks & Regards
Viraj Hudlikar.