UI Page Report Building

davidpanson
Mega Expert

Hi All,

I'm still newer to any back end processing type stuff. I created a UI page. I read this article: Embedding reports in Jelly

to figure out how to embed reports into Jelly. I can successful embed a pre-made report but I'm using a UI page to make a custom report form. I'd like some help connecting the elements. I can run a report. I can create the drop downs or buttons I need. I don't really know how to make them communicate though.

Here is my practice page. I just added a drop-down and a text field and am running a report on the incident table.

UI page.PNG

here is the html I'm using:

jelly.PNG

and here is where I need help:

client script.PNG

what kind of processing do I do to connect the dots? I've already checked around for helpful links and am not really getting a clear picture of how it comes all together from the references I've found. That may be from my lack of knowledge of Jelly/Jexl/JavaScript though. Some guidance would be appreciated.

Thanks.

1 ACCEPTED SOLUTION

You should build your encode query, you can prepare and copy from your list


Encoded Query Strings - ServiceNow Wiki




//base query: active=true^category=request^priority=1


var prio = 2; // or dynamic via a select..


var category = 'request';


var query = 'active=true^category=' + category + '^priority='   + prio



pass the query value to the sysparm_query value


View solution in original post

4 REPLIES 4

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Change the submit to type button and try something like this.


This example makes the title dynamic.



<input type='button' onclick='getChart()' />




function getChart() {


var title = $j('#title').val();


var params = {sysparm_title: title, prop2:"prop2"};




var div = $j("#report_stuff");
embedReportByParams(div, params);


}



getChart(); //call function on page load


Thanks that was helpful. It did make the title dynamic.



But I still can't figure out how to make a report with more filters. Such as if I wanted to specify only return active records. I see you can do a sysparm_query but only for 1 attribute from what I understand. So what can you do if you want to build a full report or with things specified such as location, state, assigned to, etc. Just multiple parameters in general.


You should build your encode query, you can prepare and copy from your list


Encoded Query Strings - ServiceNow Wiki




//base query: active=true^category=request^priority=1


var prio = 2; // or dynamic via a select..


var category = 'request';


var query = 'active=true^category=' + category + '^priority='   + prio



pass the query value to the sysparm_query value


Sonia32
Kilo Contributor

Hi,

I'am unable to generate a report by using above code. After entering the titile name on click of submit button Iam not getting report.

Is there any other modifications do i need to do to the above listed code, If so please let me know as I'am new to jelly scripting.

Thankyou.