Replay to email received from the activity log in the classic UI by pressing replay all

lior grinberg2
Tera Expert

HI,

I saw in instance (that I don't have access to) that there is an option to add to the activity log the ability to replay/replay all/forward  to an email that was received by pressing a button.

Can any one help me with this requirement?

I do know that the ability to replay to an email is in the workspace but my customer wants to work in the classic ui and he wants the ability to replay to an email from the activity log it self.

Hope I was clear.

Thanks to any one that answer,

Lior Grinberg

 

2 REPLIES 2

Punit S
Giga Guru

It is possible to add custom buttons to the activity log in ServiceNow Classic UI using UI Actions. UI Actions are scripts that run on the client-side or server-side and can be used to perform custom actions, like opening a form, updating a record, or sending an email.

To add a custom button to the activity log, follow these steps:

  1. Navigate to the activity log list view in ServiceNow Classic UI.
  2. Click the "Form Layout" button in the top right corner of the screen.
  3. Click the "UI Actions" tab.
  4. Click the "New" button to create a new UI Action record.
  5. Enter a name for the UI Action, like "Reply to Email".
  6. Select "List Context Menu" as the "Client" value, and "All" for "Applies to" to ensure that the UI Action is visible for all users.
  7. In the "Action" field, select "Run Script".
  8. In the "Script" field, add JavaScript code that sends an email in response to the selected email in the activity log.

Here is some sample code that sends an email in response to the selected email in the activity log:

(function() {
  var gr = g_list.getChecked();
  if (gr && gr.length > 0) {
    // Get the first selected record in the activity log
    var selected = gr[0];
    
    // Get the email address of the sender
    var sender = selected.getValue("email");
    
    // Create a new email record
    var email = new GlideRecord("sys_email");
    email.initialize();
    email.type = "send-ready";
    email.recipients = sender;
    email.subject = "RE: " + selected.getValue("subject");
    email.body = "Type your reply message here.";
    
    // Save the email record
    email.insert();
    
    // Show a confirmation message
    gs.addInfoMessage("Reply sent to " + sender);
  }
})();

This code gets the first selected record in the activity log, gets the email address of the sender, creates a new email record with a "RE:" prefix in the subject line, and sends it to the sender.

You can modify this code to include additional functionality like forwarding the email or sending the email to multiple recipients. Once you have created the UI Action, it will appear as a custom button in the activity log for all users.

 

Please mark my answer as a solution/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.

Thanks,
Punit

I found the solution:

I add the system property: glide.ui16.emailStreamResponseActions

Type: true/false

Value: true

Made sure that in the property: glide.ui.activity.email_roles all the rellvant roles are there including admin

and then I got this in the activity log:

liorgrinberg2_0-1682675727757.png