Query in Widget in SP portals

devservicenow k
Tera Contributor

 In SP portals i need to Show the records of sn_customerservice_case and sn_customerservice_task records from task_time_worked.

so i used Add encoded Query to query the Records,

instead of using gr.addEncodedQuery('taskSTARTSWITHCS'); this encoded query how can i query the data?

in what other way can i query the data?0201b.jpg

i no need to use add encoded query , i need to call from add Query();

@jaheerhattiwale  can you help me in this?

3 REPLIES 3

jaheerhattiwale
Mega Sage
Mega Sage

@devservicenow k You can use below query instead of the one you used.

 

gr.addEncodedQuery("task.sys_class_name=sn_customerservice_task^ORtask.sys_class_name=sn_customerservice_case");
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Laszlo Balla
ServiceNow Employee
ServiceNow Employee

You can use the following with addQuery() method:

 

gr.addQuery('task.name','STARTSWITH','CS');

 

For your reference, here's the link to the documentation of addQuery() that lists all operators:

GlideRecord | ServiceNow Developers