Pass Dynamic values from condition builder to scripted filter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2020 10:35 AM
Hi
I have developed the scripted filter that is working as expected with static values as a parameters. Now I am trying to make it 100% dynamic and to achieve this I need to pass dynamic values from condition builder to my classless script include. i.e. First param should be the Table name on which I am applying my filter and 2nd param should be the field name selected in the condition builder. See the screenshot below
Any help would be highly appreciated.
Thanks & Regards,
Sharjeel
Muhammad
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 08:34 AM
Hi,
I doubt you can pass dynamic parameters there since current object holds the table name and you cannot use it there
you can try exploring whether you are able to access the URL inside that function. Probably that would help knowing the table name etc
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 08:55 AM
Hi Ankur,
Thank you for your response.
Yes I have tried accessing URL and many other ways but got no luck. It is only accepting static parameters. However, I am still exploring let see.
Thanks Again,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 01:19 PM
Hi Sharjeel,
Param1 can be some how managed from URL as it will represent sys_class_name. For instance, if I try opening a list of incident my URL is
& can somehow manage to pull the table name but for Param2 what field is selected is no where stored so difficult to retrieve. However, after applying filter if you run you can fetch it form URL.
So, bit difficult & not sure if that can be achieved.
Would you mind sharing your complete business use case once so that if possible we can come up or look for other available alternatives.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 01:42 PM
Hi Jaspal,
Thank you for your response.
Actually, I was working on few filters. Let say Does not ends with so I wrote a scripted filter that is working fine but I got stuck when I try to make it dynamic.
Thanks again,
Sharjeel
Muhammad