Hide 'Compose email' button when record is inactive

matej_h
Tera Contributor

Hello community,

 

I'm kinda wondering why something like this is not enabled in Service Now by default. 

The thing is, I've got a request from my customer that they want to disable the email client ('Compose email' UI action) hidden when a record is inactive.

I've already tried some approaches I found online and with the help of my colleagues but nothing really helped (adding a condition "current.active == 'true'" to the UI Action isn't working for me).

I checked this also in plain PDI and found out that by we cannot see the 'Compose email' UI action in incidents when the incident is inactive.

 

BUT

 

In all other tables where the email client is enabled, you can use it even when the record is inactive (RITM, SCTASK, CHG).

 

Have I missed something? Have you guys ever worked on something like this please? Could you maybe explain how this work and if it's even possible to conditionally disable the 'Compose email' UI action?

 

Thank you in advance!

mh

2 ACCEPTED SOLUTIONS

Mark Manders
Tera Patron

You can create an onLoad client script like this (on the tables where you want to hide it):

function onLoad() {
var active = g_form.getValue('active');
if(active == false) { 
$('email_client_open').hide();
}
}

View solution in original post

6 REPLIES 6

Mark Manders
Tera Patron

You can create an onLoad client script like this (on the tables where you want to hide it):

function onLoad() {
var active = g_form.getValue('active');
if(active == false) { 
$('email_client_open').hide();
}
}

matej_h
Tera Contributor

Thank you for such quick replies @Dr Atul - LNG and @Mark Manders, 

This script Mark is mentioning can be found in one of the links AG posted. I tried to implement the script but it hid the client even for active records.

phewww.... 😞 @Mark Manders  any help here. I am not a coder so tough for me to trouble shoot.