189 views

Description

Reply inbound email action ignoring execution condition when the referenced record does not exist and executes the inbound email action even though the condition to do so is never met.

Steps to Reproduce

 

  1. Modify OOB inbound action 'Update Incident (BP)' as follows:
    • Action type = Reply Email
    • Order = 25
    • Conditions:
      • Subject contains Arrangements: and
      • Subject is not empty
    • Condition:
      email.subject.indexOf("Arrangements:") >-1
    • In actions add some text to Reply email
  2. Create an incident making the caller, and assigned to a user in sys_user that has your @servicenow.com email address. This should send an outbound email to your account by either notification Incident opened for me and/or Incident assigned to me
  3. Delete the incident created in step 2.
  4. When the email arrives at your email client select Reply and send the reply back
  5. When the email is processed on the instance this is in the log for the received email:
    • Created Reply Message for Update Incident (BP)

      This should not happen since the conditions have not been met for the Update Incident (BP) inbound action
  6. To test that the condition is indeed correct, repeat steps 2 and 4. For example, skip deleting the new incident, when the Reply email is processed, the inbound action Update Incident (BP) is not executed since the conditions are not met:
    • Skipping Update Incident (BP), condition subjectLIKEArrangements:^subjectISNOTEMPTY^EQ failed.

The condition is apparently not being checked in the error case when the incident record is not found, but it should be. This results in the inbound action being incorrectly executed and sends the reply email when it shouldn't.

Workaround

Because of the solution to PRB635843, there is no way to use reply email restricted by conditions when the target record does not exist. The route to go is to make your own reply email.

Here's a sample:

var replyEmail = new SNC.Email();
replyEmail.to = [email.from];
replyEmail.subject = "Re: " + email.subject;
replyEmail.text = "Reply Email";
replyEmail.html = "<body><h1>Reply Email.</h1><p>Details.</p></body>";
SNC.EmailService.send(replyEmail);
// We'll create text from html or html from text if you leave one of them off
 
This code should be placed in the Script actions section. Note that in some releases the html validation of requires xhtml, so if you are having problems getting emails to generate, set the property glide.email.body_html_validation_rule to none.
 
Alternatively, a sys_email record could be manually generated, but Email Service is the advised route on Istanbul+.

Related Problem: PRB1159099

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-03-19 06:54:23
Published:2018-03-19