<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434090#M91016</link>
    <description>&lt;P&gt;Greetings Folks.&lt;/P&gt;
&lt;P&gt;We are bringing other Business Units into oru ServiceNow instance. Our Facilities dept is going live with the Nuvolo application next week and our e-mail ingestion is still not figured out.&lt;/P&gt;
&lt;P&gt;I am trying to figure out A: How to&amp;nbsp;get emails coming into the instance that are intended for the facilities dept.&lt;/P&gt;
&lt;P&gt;Then B: How to get that email to generate a Workorder in the Nuvolo application rather than a New Call in the Service Desk application.&lt;/P&gt;
&lt;P&gt;Our New Calls are simply emails set to our Help Desk mailbox are also sent to the ServiceNow instance and create new Calls. The inbound email actions for that were fairly straight-forward.&lt;/P&gt;
&lt;P&gt;My challenge is how do I get emails sent to the facilities mailbox to come into servicenow and get ingested to the Nuvolo app rather than the Service Desk app?&lt;/P&gt;
&lt;P&gt;Nuvolo themselves had crafted an inbound email action but it did not work as they had expected it would...&lt;/P&gt;
&lt;P&gt;I can't have the Facilities desk auto-forward the messages to SN because then all the workorders will be from the Facilities desk rather than the person reporting the issue.&lt;/P&gt;
&lt;P&gt;Any suggestions on how to make this work?&lt;/P&gt;
&lt;P&gt;We also have our HR dept (and then have 9 different mailboxes) and our Finance dept coming onto the instance within the next 2-3 months so I need to find a universal solution...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All advice is appreciated!&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;A.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Feb 2019 18:18:33 GMT</pubDate>
    <dc:creator>Shawn Horley</dc:creator>
    <dc:date>2019-02-28T18:18:33Z</dc:date>
    <item>
      <title>Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434090#M91016</link>
      <description>&lt;P&gt;Greetings Folks.&lt;/P&gt;
&lt;P&gt;We are bringing other Business Units into oru ServiceNow instance. Our Facilities dept is going live with the Nuvolo application next week and our e-mail ingestion is still not figured out.&lt;/P&gt;
&lt;P&gt;I am trying to figure out A: How to&amp;nbsp;get emails coming into the instance that are intended for the facilities dept.&lt;/P&gt;
&lt;P&gt;Then B: How to get that email to generate a Workorder in the Nuvolo application rather than a New Call in the Service Desk application.&lt;/P&gt;
&lt;P&gt;Our New Calls are simply emails set to our Help Desk mailbox are also sent to the ServiceNow instance and create new Calls. The inbound email actions for that were fairly straight-forward.&lt;/P&gt;
&lt;P&gt;My challenge is how do I get emails sent to the facilities mailbox to come into servicenow and get ingested to the Nuvolo app rather than the Service Desk app?&lt;/P&gt;
&lt;P&gt;Nuvolo themselves had crafted an inbound email action but it did not work as they had expected it would...&lt;/P&gt;
&lt;P&gt;I can't have the Facilities desk auto-forward the messages to SN because then all the workorders will be from the Facilities desk rather than the person reporting the issue.&lt;/P&gt;
&lt;P&gt;Any suggestions on how to make this work?&lt;/P&gt;
&lt;P&gt;We also have our HR dept (and then have 9 different mailboxes) and our Finance dept coming onto the instance within the next 2-3 months so I need to find a universal solution...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All advice is appreciated!&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;A.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 18:18:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434090#M91016</guid>
      <dc:creator>Shawn Horley</dc:creator>
      <dc:date>2019-02-28T18:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434091#M91017</link>
      <description>&lt;P&gt;So is the idea that user emails facilities@yourcompany.com and you want that to process on the ServiceNow side as a "facilities ticket"?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 18:41:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434091#M91017</guid>
      <dc:creator>Uncle Rob</dc:creator>
      <dc:date>2019-02-28T18:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434092#M91018</link>
      <description>&lt;P&gt;How we initially setup handling multiple email addresses is simple. We had a single "New" rule that had a giant "if / else if" structure inside similar to this:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;if (email.direct.toLowerCase().indexOf('myemail@myemail.com') != -1 || email.copied.toLowerCase.indexOf('myemail@myemail.com') {
....
}
else if (email.direct.toLowerCase().indexOf('another_one@myemail.com') != -1 || email.copied.toLowerCase.indexOf('another_one@myemail.com') {
....
}
else {
// This is our "catch all" and handles anything not specified above OR was BCC'ed
...
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now why we chose to use "indexOf" instead of a straight comparison I am unsure as that's how our consultant set it up many, many, many years ago.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We still use the above for most of the incoming messages but now we also use additional Inbound Email Actions that run for type of "New". These just have the condition similar to below and use an "Order" field that is greater than the above set of rules. We use "Stop Processing" to stop it once it's processed.&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;email.origemail.toLowerCase() == "facilities@my_email.com"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We use Office365 and we setup "Mailbox Forwarding". You'll notice in the above we are looking for who the message was sent to (our generic mailbox). It maintains who sent it and logs the call under them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 18:41:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434092#M91018</guid>
      <dc:creator>TrevorK</dc:creator>
      <dc:date>2019-02-28T18:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434093#M91019</link>
      <description>&lt;P&gt;Basically this.&amp;nbsp; All it takes is for your email team to send stuff destined for facilities@yourcompany.com to ALSO go to yourcompany@ServiceNow.com.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 18:46:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434093#M91019</guid>
      <dc:creator>Uncle Rob</dc:creator>
      <dc:date>2019-02-28T18:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434094#M91020</link>
      <description>&lt;P&gt;Exactly right Robert!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 21:08:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434094#M91020</guid>
      <dc:creator>Shawn Horley</dc:creator>
      <dc:date>2019-02-28T21:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434095#M91021</link>
      <description>&lt;P&gt;Greetings Trevor&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the response!&lt;/P&gt;
&lt;P&gt;It does help. We are also on O365, and our Help Desk and App Support emails are handled similarly for SN ingestion except we Duplicate send rather than Auto-forward: (any mail coming to this address: ####@blahblahblah.com also send to this address: ###@service-now.com-blah)&lt;/P&gt;
&lt;P&gt;I am more used to configuring Inbound Email Rules to handle traffic. I am just unsure how to script this as I am a code Noob.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;A.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 22:18:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434095#M91021</guid>
      <dc:creator>Shawn Horley</dc:creator>
      <dc:date>2019-02-28T22:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434096#M91022</link>
      <description>&lt;P&gt;So now my question becomes: How to script the Inbound Action to have it create the Work Order under the name of the original sender, and not the mailbox it was forwarded from. Can anyone provide an example of that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;A.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 18:06:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434096#M91022</guid>
      <dc:creator>Shawn Horley</dc:creator>
      <dc:date>2019-03-01T18:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434097#M91023</link>
      <description>&lt;P&gt;It's all in how you do your mailbox forwarding. I see you're on Office 365 too - here is a screenshot (and I apologize I have no drawing tools on this laptop so it's all free-hand):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/163998i23F39E7EF9BF0F3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Click settings (upper right), go into Forwarding, enable it, then set your SN instance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's pretend joe@gmail.com sends facilities@yourcompany.com an email message. If you enable forwarding as per above (your admin's can do it in the back end too) the message that arrives in ServiceNow will still show joe@gmail.com as the sender and facilities@yourcompany.com as the recipient. Nowhere will it show your ServiceNow email address.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore in your inbound action you can use the code I posted above -&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;email.direct.toLowerCase()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;email.copied.toLowerCase()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;email.direct is a comma separated list of who it is sent to (so that's why the indexOf) and email.copied is a comma separated list of who it was CCed to.&lt;/P&gt;
&lt;P&gt;Here is the email object: https://docs.servicenow.com/bundle/london-servicenow-platform/page/administer/notification/reference/r_AccessingEmailObjsWithVars.html&lt;/P&gt;
&lt;P&gt;You convert toLowerCase to eliminate the chance that someone used mixed case in sending to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now this helps with the inbound action/forwarding but the other part is linking the request to the guest. You will notice in the email object doc above you can use the following to get the sys_id of the person who sent it: &lt;VAR class="keyword varname"&gt;email.from_sys_id&lt;/VAR&gt;&lt;/P&gt;
&lt;P&gt;In our environment we actually have multiple email addresses for the same user (very long story that would confuse things) so we wrote our own function in a script include. This was written many years ago (and maybe not even by us) so please don't judge the code too poorly:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;	getCaller : function(emailaddy) {
		var gr = new GlideRecord("sys_user");
		gr.addQuery("email",emailaddy);
		gr.addQuery("user_name", "DOES NOT CONTAIN", "chat.user");
		gr.query();
		
		// IF = multiple users match the email address
		if (gr.getRowCount() &amp;gt; 1) {
			// We have unique scenarios where multiple
			// people have the same email address. It's
			// all custom logic and quite long so I'm
			// taking it out not the confuse things
		}
		// ELSE IF = one user matches the email address. Return that user.
		else if (gr.getRowCount() == 1) {
			gr.next();
			return gr.sys_id;
		}
		// ELSE = a user does not match the email address. Return GUEST
		else {
			return "sys_id_of_guest_user";
		}
	},&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So our inbound action looks like:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;// This is the script include above
var scriptInclude = new CallerFromEmail();
var sid = scriptInclude.getCaller(email.origemail);

if (email.direct.toLowerCase().indexOf('facilities@me.com') != -1 || email.copied.toLowerCase().indexOf('facilities@me.com') != -1) {
    var gr = new GlideRecord('incident');
    gr.initialize();
    gr.u_new_call = current.sys_id;
    gr.caller_id = sid;
    gr.contact_type = 'email';
    gr.u_caller_email = email.origemail;
    gr.assignment_group.setDisplayValue('Facilities');
    gr.short_description = email.subject;
    gr.description = current.description;
    gr.u_group_email = 'Facilities &amp;lt;facilities@me.com&amp;gt;';
    gr.incident_state = 1;
    incId = gr.insert();

    var si = new CloneEmail();
    si.cloneEmailToINC(current.sys_id, email.uid, incId);
    current.state = 3;
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does that help? There are always many (and probably better) ways to do it but this is how we have done it for years and never really looked into changing it.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 18:41:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434097#M91023</guid>
      <dc:creator>TrevorK</dc:creator>
      <dc:date>2019-03-01T18:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Email ingestion: How to have emails for multiple Departments/Applications get actions appropriately?</title>
      <link>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434098#M91024</link>
      <description>&lt;P&gt;Greetings TrevorK&lt;/P&gt;
&lt;P&gt;Yes I think this will help a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 20:19:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/email-ingestion-how-to-have-emails-for-multiple-departments/m-p/1434098#M91024</guid>
      <dc:creator>Shawn Horley</dc:creator>
      <dc:date>2019-03-01T20:19:32Z</dc:date>
    </item>
  </channel>
</rss>

