Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Inbound action doesn't work

fabrizio95360
Tera Expert

Hi,

I'm doing an inbound action which, if the word 'salesapp' is present in the subject, creates a record for me in the Custom table. But the inbound action doesn't really start. I flagged the 'stop processing' field because I had read that there was a conflict with the incident table. But even if I flag the field it doesn't work.

 

fabrizio95360_0-1722006763300.png

 

this my script :

 

 

 

 

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
	gs.info('test Inbound action');


    var gr = new GlideRecord('sn_customerservice_supporto');
    gr.initialize();

    gr.u_ambito = "support_other_channels";
    gr.contact_type = "Email";
    gr.u_typology = "sales_app";
    gr.category = 22;
    gr.subcategory = "Richiesta Supporto";
    gr.short_description = email.subject;
    gr.description = email.body;

 
    var cfCliente = email.body.match(/CF Cliente:\s*(.*)/)[1]; 
    var customer = new GlideRecord('customer_account');
    if (customer.get('u_tax_reg_id', cfCliente)) {
        gr.account = customer.sys_id;
    }

    gr.insert();


   
    var emailRicontatto = email.body.match(/Indirizzo email per ricontatto:\s*(.*)/)[1];
    if (emailRicontatto) {
        gr.u_indirizzo_email_di_contatto = emailRicontatto;
        gr.update();
    }

})(current, event, email, logger, classifier);

 

 

 

the email I receive: 

Immagine 2024-07-26 171743.png

1 REPLY 1

Kristy Merriam
Administrator
Administrator

I believe your issue is related to the email you are sending being a Forward email rather than New that is indicated in the Email Action. Try changing the Type field to 'Forward' and try to to reprocess it.