Pass Dynamic values from condition builder to scripted filter

MrMuhammad
Giga Sage

Hi @Allen/ @Ankur Bawiskar / @Jaspal Singh/ @Dirk / @Ashutosh, 

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

find_real_file.png

 

Any help would be highly appreciated.

Thanks & Regards,

Sharjeel

Regards,
Muhammad
10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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

Regards,
Muhammad

Jaspal Singh
Mega Patron
Mega Patron

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 

/nav_to.do?uri=%2Fincident_list.do%3Fsysparm_clear_stack%3Dtrue%26sysparm_query%3Dactive%3Dtrue%26sys...

& 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.

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    

Regards,
Muhammad