Hide Declarative Action Button on HR Agent Workspace if No Related List Records are Found

MaryiaM
Tera Contributor

Hi, I have a Download button displayed in a related list on HR Agent Workspace using the UX Declarative Action implemented as Client Script. If the related list is empty, I would like to hide that button.

I've tried applying the client conditions on the declarative action itself (using count etc), but that didn't work. I've also created a script include method which I'm calling in the script condition of the declarative action where I've tried passing the parent.sys_id (ex. new utils.relatedListHasRecords(parent.sys_id), and then querying the related list table (Employee Document Management) to get the row count, the issue is that the query is not specific enough to get row count results for specific related lists.

Does anyone know if there's a way to get the query for the related list in the script condition of a declarative action (which is server script)? I know it's possible to get the related list query using Glidelist api (g_list.getQuery()) but that only works in client scripts and not server scripts. Also what does the "current" stand for when you pass it as a parameter in the script condition of the declarative action for the related list, I've tried logging the sys_id for current in the script inlcude method but it's coming back as null.

 

Any suggestion would be much appreciated! Thanks so much in advance! 

0 REPLIES 0