Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Filter Quick Messages based on table

uluerje
Mega Expert

Does anyone know if there's an easy way to filter the quick messages based on the table?   We currently have groups/users who work tickets in multiple areas (tables) and each area has it's own set of standard responses - quick messages.   I'd like to show only the quick messages that pertain to the area/ticket that they're working in and hide all the others.    

Example:

- Group A works incidents and requests.

- We have 5 quick messages set up for incidents and 5 quick messages set up for requests - all available to Group A

- If they're working an incident, we want to only show the 5 quick messages that are for incidents and hide the requests.

The only "solution" I've been able to come up with is creating a dropdown on the table that would hold all their quick message titles and then creating a client template for each one - so in a sense making the client template a quick message.   I'd rather not do this if there's a better way to accomplish this.  

Any help would be greatly appreciated!   Thanks!

1 ACCEPTED SOLUTION

DrewW
Mega Sage

As far as I am aware the email_client UI Page is not accessible by a customer.   So you have two options, create your own from scratch, or add a field to the quick messages table for the table that they are for.   Then set a session var/client data using an on display business rule when the user goes to the form and then add a BR to the Quick Messages table to use that session var as a filter.   Might be a bit clunky but it should work ok.


View solution in original post

6 REPLIES 6

DrewW
Mega Sage

As far as I am aware the email_client UI Page is not accessible by a customer.   So you have two options, create your own from scratch, or add a field to the quick messages table for the table that they are for.   Then set a session var/client data using an on display business rule when the user goes to the form and then add a BR to the Quick Messages table to use that session var as a filter.   Might be a bit clunky but it should work ok.


Thanks for the suggestion!   I'll give it a try!


robhaas
Tera Contributor

uluerje ,



Were you able to accomplish this? I'd like to see what you came up with if so and you don't mind.


Hi Robert,


Yes, I was able to successfully filter the quick messages.  



1. Created a 'u_table' string field on the quick message table and added the table name to the messages I want to filter - doesn't have to be the actual table name...it just has to match whatever you set the client data to when the form loads  



2. Created a display business rule on the tables where I want the quick messages filtered and set the client data to the table name (matched the quick message table value exactly) - only runs for specific group or role


Incident table   -   gs.getSession().putClientData('table', 'incident');  


Request table -   gs.getSession().putClientData('table', 'request');


Test table (no filter - show all QM) - gs.getSession().putClientData('table', '');  



3. Created a before query business rule on the quick message table to only show the messages where the u_table values matches the client data value - only filters if client data value exists, else show all.



var v = gs.getSession().getClientData('table');


  if (v != ''){


    var qc = current.addQuery("u_table", v);


  }



Hope this helps.