We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Description Field empty when Email Is sent create incident record

ADJARATOUT
Tera Contributor

Hi,
When an email is sent, an incident record is created, but the description field is empty in the incident record, while the body of the email is not empty.

ADJARATOUT_0-1771166605667.png

 

1 ACCEPTED SOLUTION

Tanushree Maiti
Giga Sage

 Hi ADJARATOUT

 

Keep that line 

current.description = email.body_text;

 

and try.

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

View solution in original post

4 REPLIES 4

Srikanth_9
Giga Guru

Hi @ADJARATOUT,

 

I have created the custom Inbound Email Action in my PDI. I'm sharing the script here, please try this and check it.

 

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
 
    //To get caller from email address
    var caller = new GlideRecord('sys_user');
    caller.addQuery('email',email.from);
    caller.query();
    if(!caller.next()){
        gs.log("No matching user for email: " + email.from); //Caller not found, optionally log or assign default
    }

    //Create Incident
    var inc = new GlideRecord('incident');
    inc.initialize();
    inc.short_description = email.subject || "No Subject";
    inc.description = email.body_text || "No description provided";

    //If caller was found, assign it
    if(caller.isValidRecord()){
        inc.caller_id = caller.sys_id;
    }

    //Set default values
    inc.category = 'inquiry';
    inc.impact = 3;
    inc.urgency = 3;

    var incidentID = inc.insert();

    //gs.log("Incident created from email: " + incidentID);


})(current, event, email, logger, classifier);
 
 
If the provided solution is useful/working, please Accept as Solution and hit the Helpful. 
 
Thanks & Regards,
Srikanth Akula.

Srikanth_9
Giga Guru

Hi @ADJARATOUT,

 

Please try the provided script and let me know whether it's working fine or not. So that I will help you to get resolved. 

 

If the provided solution is useful/working, please Accept as Solution and hit the Helpful. 
 
Thanks & Regards,
Srikanth Akula.

 

Tanushree Maiti
Giga Sage

 Hi ADJARATOUT

 

Keep that line 

current.description = email.body_text;

 

and try.

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Srikanth_9
Giga Guru

Hi @ADJARATOUT

 

Please accept the solution if it's useful/working.

 

If the provided solution is useful/working, please Accept as Solution and hit the Helpful. 
 
Thanks & Regards,
Srikanth Akula.