Need help on Filter in Simple List to display task(s) associated with a RITM

rishabh31
Mega Sage

Dear Team,

 

This is related to a similar ask posted earlier, refer to the below URL-

https://www.servicenow.com/community/developer-forum/simple-list-to-display-task-associated-with-a-r...

 

Requesting help on the Filter field of the Simple list widget (screenshot highlighted section) so that it displays only those task(s) associated with a RITM when the user access Service Portal> My Requests-RITMXXXXXX.

 

Currently, I applied the filter 'request_itemISNOTEMPTY' filter on the sc_task table but it displays all Tasks in the instance, which is not desired.

rishabh31_0-1682068886850.png

Please help on this

 

Thank you

3 ACCEPTED SOLUTIONS

Hello @rishabh31 ,

 

So, I used the Widget "Data Table from Instance Definition" and used the "Clone Widget" UI Action

Joshua_Quinn_0-1682294718595.png

 

Then, in the clone, I updated the Server script to enhance my filter (in my use case, I was looking at Catalog Tasks tied to RITMs, so my script update occurred at around line 25, where I added the filter for the sys_id of the current record to the filter on the data table. I then check to see if there is a filter from the widget itself. If not, then the word "Null" would be present and I forgo adding it:

Joshua_Quinn_1-1682295168343.png

 

Finally, I add the widget to the page and then set the table and fields I want on the table. If you want a custom filter, you can set it due to the filter check we did on line 35 and it will append that filter here.

View solution in original post

BharathChintala
Mega Sage

@rishabh31  Simple list won't work in this scenario

 

In Standard ticket configuration

 

you can add new tab called Tasks configure accordingly.

 

Below is OOB custom one created wm_order table to get their tasks.

Similarlly you can do for Requested item as well

BharathChintala_0-1682339878163.png

 

 

BharathChintala_1-1682339878449.png

 

 

 

BharathChintala_2-1682339878146.png

 

They used "Work order Tasks for Work Order" widget we have to create one new widget replicate same for sc_tasks.

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

View solution in original post

Terribly sorry @rishabh31 ,

 

I should have realized my mistake when sending you the screenshots. I had a bug in my code. On line 27 of your server script, it should read:

data.filter = "request_item=" + sys

without that "=" the filter will fail, which is what is happening. Please try that and let me know your results.

 

Thanks!

 

View solution in original post

16 REPLIES 16

jmfonseca
Tera Contributor

Hi rishabh31

 

Adding up this condition on the filter: 

jmfonseca_0-1682088249587.png

Hope this helps.

 

If I have answered your question, please mark my response as correct  or helpful so that others with the same question in the future can find it quickly.

Hi @jmfonseca ,

Thank you for your response, I tried this but not working because my requirement is supposed I have submitted a Request, created RITM and later RITM has its catalog tasks associated with it, so I want when the end user opens that request through the portal so they can see its associated catalog task(s) only through this simple widget but currently all the listed catalog tasks are displaying through this simple widget which is not desired.

 

Please help to achieve this

jmfonseca
Tera Contributor

Hi,

 

Adding up the filter condition like this:

jmfonseca_0-1682089383525.png

Hope this helps.

OlaN
Giga Sage
Giga Sage

Hi,

What's the use case for showing the number of SCTASKS ?
In most cases I would assume the end user doesn't care about how many tasks that needs to be done, they are interrested in when the request is completed.