Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Empty Target record on processed emails - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Empty Target record on processed emails
KB0547763

Empty Target record on processed emails


14858 Views Last updated : Feb 5, 2025 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

The processed email records in the Received mailbox (System Mailboxes > Received) have an empty value in the Target field. The user does not know which record, or even if a record, was created or updated as a result of processing the email record.


Target Field is empty even after inbound action was processed

Symptoms

  • The email record has a state of Processed, but the Target field is empty.
  • The email log shows that there is an inbound action that was skipped because it did not update or create a record.
Action was skipped because it did not create or update a record

 

 

Release

All releases

Cause

When an inbound action processes an incoming email, it uses the variable current to represent the record that it affects.

If a new record is to be created, then-current represents a new empty record for the target table suitable for the population before an insert.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
//Sample inbound action script creates an incident record 

current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail;
current.short_description = email.subject;

current.category = "request";
current.incident_state = 1;
current.notify = 2;
current.contact_type = "email";

current.insert(); //<--When line completes, it will update the target 
// field on the email record with a reference to the created record


If an existing record is to be updated, then current represents a reference to the record that is to be updated.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
gs.include('validators');

if (current.getTableName() == "incident") {
    current.comments = "reply from: " + email.origemail;
    
    if (email.subject.toLowerCase().indexOf("please reopen") >= 0) {
        current.state = "2";
        current.work_notes = "Issue was not resolved";
    }

    current.update(); //<--When this line completes, it will update the Target field 
//on the email record with a reference to the updated record }


If the script does not use variable current to update or create a record, the system does not know which record was affected and therefore is not able to fill in the Target field.

Resolution

  • Whenever possible, use the already-provided current to update or create the target record.
    Or:
  • If this is not an option because the script updates a record that does not belong to the Target table, or if you update/create more than one record, then consider manually logging the changes made by your custom action using gs.log() as described in product documentation.
1
2
3
4
5
6
7
8
var grIncident = new GlideRecord('incident');
grIncident.initialize();
grIncident.caller_id=gs.getUserID();
grIncident.comments = "received from: " + email.origemail;
grIncident.short_description = email.subject;
grIncident.insert();
//create log entry to know what created/update by this action
gs.log("<custom_action_name> Created Incident:" + grIncident.number, "EMAIL." + sys_email.sys_id);

        You should then be able to view the record that was created or updated in the email logs.


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

Attachments

Attachments

  • emptyTarget.png

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.