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.

Exporting incident history, including outbound emails

kholloway
Tera Contributor

I have a request from a department at my company to export the entire incident history for a handful of incidents. They want to see the usual incident information along with notes, customer communication, or outbound/inbound email done within that incident, ideally in an Excel spreadsheet. When I attempt to create a database view joining incident (where inc.number > 'INC0000000''), sys_journal_field (where inc.sys_id = jour.element_id), and sys_email (where em.instance = inc.number), I get no results. When I leave out the sys_email table, I get information, but it seems that there are duplicate entries and I'm only seeing the customer communication, not the response form one of our employees. I know it is not recommended (maybe not even possible?) to run database views on sys_email, or I could have my where clauses set up incorrectly. Is there any way to pull this information? 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@kholloway 

don't join all 3 tables together incident, sys_journal_field and sys_email

The sys_email table is system table and having database view on it might lead to performance

Try to join incident and sys_journal_field and then incident with sys_email and take export

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thank you, but joining sys_email and incident does not result in the header information or body of the email being visible.

@kholloway 

which other fields are visible?

Might be platform issue

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I'm working with SN support now to try to find a resolution. Thanks for your help.