Attaching a Multilevel Pivot Report to an Email Notification is not working


Description

Attaching a Multilevel Pivot Report to an Email Notification is not working.

Release or Environment

All available releases.

Cause

If the report attached to the email notification is of type Multilevel Pivot, you will need to enable plugin - Webkit HTML to PDF (com.snc.whtp).

If you look in the logs you will see the following error when the email was processed by job - events process.

2020-03-24 06:20:10 (535) worker.5 worker.5 txid=2ae47d34db33 WARNING *** WARNING *** null
java.lang.NullPointerException
at com.snc.platform.security.oauth.dao.CredentialRepo2.addTypePeerScopesUserQueryParts(CredentialRepo2.java:104)
at com.snc.platform.security.oauth.dao.CredentialRepo2.getActiveTokenByPeerScopesAndUser(CredentialRepo2.java:193)
at com.snc.platform.security.oauth.dao.CredentialRepo2.updateOrGenerateToken(CredentialRepo2.java:284)
at com.snc.platform.security.oauth.dao.CredentialRepo2.updateOrGenerateToken(CredentialRepo2.java:277)
at com.snc.platform.security.oauth.processor.OAuthTokenProcessor.doInternalGrant(OAuthTokenProcessor.java:257)
at com.snc.platform.security.oauth.processor.OAuthTokenGenerator.grantSessionUserAccessToken(OAuthTokenGenerator.java:23)
at com.snc.platform.security.oauth.OAuthAPI.grantSessionUserAccessToken(OAuthAPI.java:57)
at com.snc.whtp.WHTPClient.queryPDF(WHTPClient.java:98)
at com.snc.whtp.WHTPExporter.generate(WHTPExporter.java:46)
at com.glide.report.Report.whtpExport(Report.java:854)
at com.glide.report.Report.genReport(Report.java:870)
at com.glide.report.Report.getInputStream(Report.java:1649)
at com.glide.notification.substitution.AEmailAttachmentGenerator.generate(AEmailAttachmentGenerator.java:174)
at com.glide.notification.substitution.EmailReportGenerator.generate(EmailReportGenerator.java:36)
at com.glide.notification.substitution.AttachmentSubstitute.replace(AttachmentSubstitute.java:49)
at com.glide.notification.substitution.SubstitutionManager.substituteToken(SubstitutionManager.java:375)
at com.glide.notification.substitution.SubstitutionManager.substituteVar(SubstitutionManager.java:213)
at com.glide.notification.substitution.SubstitutionManager.substitute(SubstitutionManager.java:156)
at com.glide.notification.substitution.SubstitutionManager.substitute(SubstitutionManager.java:129)
at com.glide.notification.outbound.EmailFormatter.substitute(EmailFormatter.java:445)
at com.glide.notification.outbound.EmailFormatter.substitute(EmailFormatter.java:414)
at com.glide.notification.cmn.NotificationDataEvaluator.evalMessage(NotificationDataEvaluator.java:231)
at com.glide.notification.cmn.NotificationDataEvaluator.changeDateTimeFormatsAndEvalMessage(NotificationDataEvaluator.java:197)
at com.glide.notification.cmn.NotificationDataEvaluator.evaluateNotificationData(NotificationDataEvaluator.java:154)
at com.glide.notification.cmn.NotificationDataEvaluator.evaluate(NotificationDataEvaluator.java:74)
at com.glide.notification.cmn.NotificationMessage.processTemplate(NotificationMessage.java:78)
at com.glide.notification.cmn.NotificationActionHandler.send(NotificationActionHandler.java:96)
at com.glide.notification.cmn.NotificationActionHandler.process(NotificationActionHandler.java:72)
at com.glide.policy.EventProcessor.process(EventProcessor.java:254)
at com.glide.policy.EventProcessor.processEventDuringNormalOperation(EventProcessor.java:218)
at com.glide.policy.EventProcessor.processEvent(EventProcessor.java:143)
at com.glide.policy.EventProcessor.process(EventProcessor.java:97)
at com.glide.policy.EventManager.processEvents(EventManager.java:291)
at com.glide.policy.EventManager._process(EventManager.java:166)
at com.glide.policy.EventManager.processDelegatedEvents(EventManager.java:140)
at com.glide.script.GlideSystem.js_processDelegatedEvents(GlideSystem.java:731)
at sun.reflect.GeneratedMethodAccessor293.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
at org.mozilla.javascript.gen._refname__191._c_script_0(:1)
at org.mozilla.javascript.gen._refname__191.call()
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3429)
at org.mozilla.javascript.gen._refname__191.call()
at org.mozilla.javascript.gen._refname__191.exec()
at com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
at com.glide.script.ScriptEvaluator.evaluateStringWithPrefix(ScriptEvaluator.java:66)
at com.glide.script.Evaluator.evaluatePossiblePrefixedString(Evaluator.java:208)
at com.glide.job.RunScriptJob.evaluateScript(RunScriptJob.java:166)
at com.glide.job.RunScriptJob.execute(RunScriptJob.java:89)
at com.glide.schedule.JobExecutor.lambda$executeJob$0(JobExecutor.java:108)
at com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:111)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:95)
at com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:329)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
at com.glide.script.ScriptEvaluator.evaluateStringWithPrefix(ScriptEvaluator.java:66)
at com.glide.script.Evaluator.evaluatePossiblePrefixedString(Evaluator.java:208)
at com.glide.job.RunScriptJob.evaluateScript(RunScriptJob.java:166)
at com.glide.job.RunScriptJob.execute(RunScriptJob.java:89)
at com.glide.schedule.JobExecutor.lambda$executeJob$0(JobExecutor.java:108)
at com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:111)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:95)
at com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:329)
at com.glide.schedule_v2.SchedulerWorkerThread.lambda$process$0(SchedulerWorkerThread.java:192)
at com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
at com.glide.schedule_v2.SchedulerWorkerThread.process(SchedulerWorkerThread.java:192)
at com.glide.schedule_v2.SchedulerWorkerThread.run(SchedulerWorkerThread.java:100)

2020-03-24 06:20:10 (536) worker.5 worker.5 txid=2ae47d34db33 WARNING *** WARNING ***
2020-03-24 06:20:10 (536) worker.5 worker.5 txid=2ae47d34db33 SEVERE *** ERROR *** com.snc.whtp: Oauth failed to grant access token
2020-03-24 06:20:10 (572) worker.5 worker.5 txid=2ae47d34db33 EMAIL.eee47d34db3380102f153c8f9d961960: Attachment: Test_attachment.pdf,application/pdf
2020-03-24 06:20:10 (624) worker.5 worker.5 txid=2ae47d34db33 EMAIL.eee47d34db3380102f153c8f9d961960: Notification 'XXXXX' (6c52796fdbeb001046c171198c961924) included recipients as member of a group in the notification's "Groups" field: 'User 1' (b88b37c0dbd940502f153c8f9d9619cc), 'User 2' (1ae4c7c94f6d5a0073cff9aba310c7e5)
2020-03-24 06:20:10 (635) worker.5 worker.5 txid=2ae47d34db33 Completed: events process 0 in 0:00:00.547, next occurrence is 2020-03-24 09:20:20

Resolution

To export Multilevel pivot tables to PDF, you must enable the Webkit HTML to PDF (com.snc.whtp) plugin.

Additional Information

https://docs.servicenow.com/csh?topicname=c_AttachingDocsToANotification.html&version=latest

https://docs.servicenow.com/csh?topicname=t_ScheduleAReport.html&version=latest