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

matej_h
Tera Contributor

When I adjust the script so it's retrieving 'State' value instead of 'Active,' it seems to be working. So the script would be

 

function onLoad() {
var ritmState = g_form.getValue('state');
if(ritmState == '3') { //3 is the value for Closed Complete (will add also value for Skipped and Incomplete) 
$('email_client_open').hide();
}
}

 

So thank you very much for this, I didn't know about this $ function.

Perfect and new learning.