logo

NJP

ServiceNow Outlook Plugin: Map the Email Body to the Description Field instead of the Comments

Import · Dec 03, 2023 · video

in this video we're going to look at modifying the service now Outlook plugin so that it Maps the email body to the description field instead of to the comments so I have up here in my Outlook the service now Outlook plug-in and I did this I did create incident and so this is the finished product and I have the description field now in the form here and you can see the body of the message mapped to well you can't see the body of the message because it's on the other screen but you see that the this is the body of the message the power went out here and now my computer won't turn on please help and the subject as it does out of the box went to the uh short description and then the additional comments are just uh left blank so out of the box uh this piece goes down here to additional comments uh I'm not sure why they did that because in all of the uh email triggers and that uh email actions the body of the email goes to description makes a lot more sense but anyway that's the way they set it up so this video is going to look at how to change it so that it goes to the description field so it's actually really straightforward uh there's just two steps the first one is going to be to modify the create incident widget so if we go into the platform view here and we go to service portal widgets and we look for create incident uh and it is in the client controller and we're going to go down to a function or a method here called populate fields and in that method on line 118 well here we can see on line uh where is it yeah line 116 we see a short description item. subject and we look up item it's getting item from maybe it's further up here oh right here yeah item equals uh window. office. context. mailbox. item um and there's a whole bunch of properties and methods in there uh I have a link or I'll put the link to the Microsoft document ation uh in the in my blog article and you can see you can get everything out of there attachments body who's in the BCC well actually no not the BCC that's for message compose but we want to get uh everything from message read um so we can get the datetime created uh from so basically everything that's in the email that we can access um so here it's just getting uh the subject and then on line 118 this is where we modify so previously this said set value comments to result. val. trim we'll just change this comments to description right so we'll write it to the description field instead of to the comments field uh so that's the simple part then we save it so it was giving me some message about this widget being read only but it let me right to it anyway if you have that problem and it won't let you write to it uh then you can do the whole dance where you clone the widget and then you'll have to put the new widget into the page uh when I'll show you what page that is that's service portal pages and it's called Outlook home right so Outlook home has this uh here let's do it in designer so has this create incident uh widget right so instead of you're going to remove this create incident widget and you're going to add the widget that you cloned or the cloned widget with the modifications in there um okay and then the second thing and this is even simpler is you're just simply going to go to the incident table and and we're going to go to form design and we're going to change the uh Outlook view to include the description field so we have somewhere to write it to uh note that this Outlook view is actually in this service now add-ins for Microsoft Office uh application scope it's not in the global scope uh so you have to be in that scope in order to modify it uh you do that and and that's it simple as that then basically when the widget you go into an email and you call the create incident or you click the create incident button uh it's going to pull up the description with the view and then the client script is going to go ahead and copy the body of the email and write it here to the description so that is how you remap uh the the body of the email to the description field rather than to the additional comments

View original source

https://www.youtube.com/watch?v=vt8Y3lOPGOs