- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I found sn_ppt_export application installed in the instance. Due to organization policy, I can not use Microsoft PowerPoint add-in to create a new template. I just create it in the instance for Operational Resilience scope. I create a new UI action and use the OOTB script 'PPTRequestHandler.runPPTGenerator' to trigger the export. But it doesn't work.
Then I try to debug in Script Debugger and found when I called PPTRequestHandler.runPPTGenerator, the servicenow internal script caught the exception, but I was passing parameters according to the script's logic.
when run in line 34, it just step into line 43 and is valued the statusCode with -1. It is servicenow internal script and I couldn't locate the error.
do anyone try to export to PowerPoint in Operational Resilience Worskspace? If it works, could you please share your experience please?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LimingWu ,
Thanks for sharing the debugger details. This additional information changes the troubleshooting direction.
Your UI Action is reaching PPTRequestHandler correctly. The failure is occurring inside the OOB POI generation layer here:
clientUtil.generate(
urlSuffix,
this.tableName,
this.tableSysID,
this.dataString,
this.stepString
);
The important point is that statusCode = -1 is not an HTTP response from your UI Action.
In PPTGenerationExtensionPointGlobal, ServiceNow itself sets:
response["statusCode"] = this.REST_ERROR;
inside the catch block.
So -1 only means that clientUtil.generate() threw an exception.
The next step is to identify the actual exception message rather than changing PPTRequestHandler.
1. Capture the real exception
In your debugger, after execution enters:
catch (ex)
step over:
responseBody = ex.message;
Then inspect:
responseBody
or:
ex.message
That value is the actual root error.
Also open:
PowerPoint Management > PPT Service Request Logs
Table:
sn_ppt_export_ppt_poi_service_request_log
Open the failed Generate request and check all available fields related to:
Status
Response body
Error message
Request type
Report type
Template
Please share that exact error if possible.
2. Do not modify PPTGenerationExtensionPointGlobal
The following are OOB/protected implementation components:
PPTRequestHandler
PPTGenerationExtensionPointGlobal
POIMain
Do not clone or modify them.
Your existing call pattern is valid:
var ppt =
new sn_ppt_export.PPTRequestHandler(templateId);
var attachmentSysId =
ppt.runPPTGenerator(
tableName,
recordSysId,
tableName,
recordSysId,
fileName
);
Passing the same table and sys_id in both positions is valid when the report is not using a different repeater context.
3. Perform an OOB control test
This is the most important troubleshooting step now.
Use an existing OOB PowerPoint template and its supported OOB record/table, if one is available in your instance.
For example, if the Project Status Report template is installed, generate a PPT from a normal Project/Project Status Report using the OOB functionality.
There are only two possible outcomes.
Case A:
OOB PowerPoint export also fails at:
clientUtil.generate()
Then your Operational Resilience Report Type and template are not the primary problem.
The issue is likely with:
- POI Service
- Export to PowerPoint application/dependencies
- Instance/data-center availability
- Service-side processing
At that point I would open a Now Support case rather than modifying the custom implementation.
Case B:
OOB PowerPoint export works successfully.
Then the POI Service is healthy and the problem is isolated to your custom:
Report Type
Template
Related Tables
Placeholders
Formatter mappings
or scripted elements.
4. If OOB export works, create a minimal Operational Resilience test
Create a new Report Type:
Name:
OR PPT Minimal Test
Main table:
Your actual Operational Resilience table
For example:
sn_oper_res_scenario_analysis
Do not configure:
- Related Tables
- Scripted Elements
- Charts
- Repeaters
- Formatter Mappings
Then create a new PowerPoint Template associated with this Report Type.
For the first test, start with the simplest possible PPTX.
Ideally, copy a valid OOB PowerPoint template and remove its existing dynamic components rather than building the first test completely from scratch.
Add only one valid field from the main table.
Then generate it using:
var templateId = 'YOUR_MINIMAL_TEMPLATE_SYS_ID';
var tableName = current.getTableName();
var recordSysId = current.getUniqueValue();
var ppt =
new sn_ppt_export.PPTRequestHandler(templateId);
var attachmentSysId =
ppt.runPPTGenerator(
tableName,
recordSysId,
tableName,
recordSysId,
'OR_Minimal_Test.pptx'
);
gs.info(
'PPT Attachment sys_id: ' +
attachmentSysId
);
If this succeeds, add the configuration back one component at a time:
Main table fields
-> Related Table
-> Additional fields
-> Repeaters
-> Formatter Mapping
-> Scripted Elements
-> Charts
This will identify exactly which component breaks generation.
5. Verify the Report Type main table
This must exactly match:
current.getTableName()
For example, if:
current.getTableName()
returns:
sn_oper_res_scenario_analysis
then the PowerPoint Report Type Main table must also be:
sn_oper_res_scenario_analysis
Do not use another parent table simply because the record extends it.
You can confirm with:
gs.info(
'PPT Table = ' +
current.getTableName()
);
gs.info(
'PPT Record = ' +
current.getUniqueValue()
);
6. Verify the template attachment
Open:
PowerPoint Management > PowerPoint Templates
Open your template and confirm:
- Exactly one .pptx attachment exists.
- The attachment is directly attached to the PowerPoint Template record.
- The file opens normally in Microsoft PowerPoint.
- File size is below 15 MB.
- The template references the correct Report Type.
ServiceNow supports one active .pptx attachment per PowerPoint Template.
7. Revisit the earlier GeneratePPTUtil errors
You previously received:
Cannot read property "isEncodedQuery" from undefined
and:
Cannot invoke GlideElement.getED() because this.fGlideElement is null
If the OOB control test works, these errors strongly point back to custom Report Type/template metadata.
Specifically review:
- Invalid field names
- Field removed after the template was created
- Incorrect Related Table
- Incorrect Parent relation column
- Formatter Mapping referencing a non-existent field
- Table/repeater referencing a table that is not configured in the Report Type
The GlideElement error is especially consistent with the generator attempting to resolve metadata for a field that it cannot find.
8. Important clarification about the PowerPoint add-in
The add-in is useful and is the documented template-authoring experience, but the underlying sn_ppt_export capability itself is not limited to SPM/APM and PPTRequestHandler can be called from other tables.
ServiceNow has also published a current employee-authored example demonstrating PPTRequestHandler on arbitrary tables.
Since your organization does not permit the add-in, I would start by copying a known-good OOB template and modifying it incrementally.
That is much safer than trying to reverse-engineer the protected POI generation code.
9. Verify POI Service availability
Export to PowerPoint depends on:
Export to PowerPoint:
sn_ppt_export
POI Service:
com.snc.poi_service
Your debugger already shows:
com.snc.poi_service.POIMain
so the POI component is present.
However, successful generation also depends on the ServiceNow-side PPT processing service being available for your hosting environment.
ServiceNow documentation specifically notes restrictions for some regulated, self-hosted, or otherwise restricted environments.
If the OOB export fails in exactly the same clientUtil.generate() call, ask Now Support to verify:
- POI service availability for your instance
- Data-center support
- sn_ppt_export version
- com.snc.poi_service status
- PPT service-side errors
- Any applicable PRB/KB for your release
Include the failed record from:
sn_ppt_export_ppt_poi_service_request_log
in the Support case.
My recommended troubleshooting path is now:
PPTRequestHandler reached successfully
-> Capture ex.message
-> Test OOB PowerPoint export
-> If OOB fails: POI/service/environment issue
-> If OOB works: custom Report Type/template issue
-> Test minimal Operational Resilience template
-> Add components back individually
I would not spend more time changing the UI Action until this OOB control test is completed. Your debugger already demonstrates that execution has passed the UI Action and entered the PowerPoint generation service.
Official references:
Export to PowerPoint overview:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
Upload PowerPoint Template:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
Current ServiceNow Employee article showing PPTRequestHandler for custom tables:
https://www.servicenow.com/community/developer-articles/export-to-powerpoint-in-servicenow-from-plat...
I would specifically check ex.message and run the OOB control test next. Those two checks should tell you whether this is a POI service issue or a custom Operational Resilience template issue.
Hope this helps!
If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.
Kind Regards,
Abhishek Pal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LimingWu ,
Thanks for sharing the debugger details. This additional information changes the troubleshooting direction.
Your UI Action is reaching PPTRequestHandler correctly. The failure is occurring inside the OOB POI generation layer here:
clientUtil.generate(
urlSuffix,
this.tableName,
this.tableSysID,
this.dataString,
this.stepString
);
The important point is that statusCode = -1 is not an HTTP response from your UI Action.
In PPTGenerationExtensionPointGlobal, ServiceNow itself sets:
response["statusCode"] = this.REST_ERROR;
inside the catch block.
So -1 only means that clientUtil.generate() threw an exception.
The next step is to identify the actual exception message rather than changing PPTRequestHandler.
1. Capture the real exception
In your debugger, after execution enters:
catch (ex)
step over:
responseBody = ex.message;
Then inspect:
responseBody
or:
ex.message
That value is the actual root error.
Also open:
PowerPoint Management > PPT Service Request Logs
Table:
sn_ppt_export_ppt_poi_service_request_log
Open the failed Generate request and check all available fields related to:
Status
Response body
Error message
Request type
Report type
Template
Please share that exact error if possible.
2. Do not modify PPTGenerationExtensionPointGlobal
The following are OOB/protected implementation components:
PPTRequestHandler
PPTGenerationExtensionPointGlobal
POIMain
Do not clone or modify them.
Your existing call pattern is valid:
var ppt =
new sn_ppt_export.PPTRequestHandler(templateId);
var attachmentSysId =
ppt.runPPTGenerator(
tableName,
recordSysId,
tableName,
recordSysId,
fileName
);
Passing the same table and sys_id in both positions is valid when the report is not using a different repeater context.
3. Perform an OOB control test
This is the most important troubleshooting step now.
Use an existing OOB PowerPoint template and its supported OOB record/table, if one is available in your instance.
For example, if the Project Status Report template is installed, generate a PPT from a normal Project/Project Status Report using the OOB functionality.
There are only two possible outcomes.
Case A:
OOB PowerPoint export also fails at:
clientUtil.generate()
Then your Operational Resilience Report Type and template are not the primary problem.
The issue is likely with:
- POI Service
- Export to PowerPoint application/dependencies
- Instance/data-center availability
- Service-side processing
At that point I would open a Now Support case rather than modifying the custom implementation.
Case B:
OOB PowerPoint export works successfully.
Then the POI Service is healthy and the problem is isolated to your custom:
Report Type
Template
Related Tables
Placeholders
Formatter mappings
or scripted elements.
4. If OOB export works, create a minimal Operational Resilience test
Create a new Report Type:
Name:
OR PPT Minimal Test
Main table:
Your actual Operational Resilience table
For example:
sn_oper_res_scenario_analysis
Do not configure:
- Related Tables
- Scripted Elements
- Charts
- Repeaters
- Formatter Mappings
Then create a new PowerPoint Template associated with this Report Type.
For the first test, start with the simplest possible PPTX.
Ideally, copy a valid OOB PowerPoint template and remove its existing dynamic components rather than building the first test completely from scratch.
Add only one valid field from the main table.
Then generate it using:
var templateId = 'YOUR_MINIMAL_TEMPLATE_SYS_ID';
var tableName = current.getTableName();
var recordSysId = current.getUniqueValue();
var ppt =
new sn_ppt_export.PPTRequestHandler(templateId);
var attachmentSysId =
ppt.runPPTGenerator(
tableName,
recordSysId,
tableName,
recordSysId,
'OR_Minimal_Test.pptx'
);
gs.info(
'PPT Attachment sys_id: ' +
attachmentSysId
);
If this succeeds, add the configuration back one component at a time:
Main table fields
-> Related Table
-> Additional fields
-> Repeaters
-> Formatter Mapping
-> Scripted Elements
-> Charts
This will identify exactly which component breaks generation.
5. Verify the Report Type main table
This must exactly match:
current.getTableName()
For example, if:
current.getTableName()
returns:
sn_oper_res_scenario_analysis
then the PowerPoint Report Type Main table must also be:
sn_oper_res_scenario_analysis
Do not use another parent table simply because the record extends it.
You can confirm with:
gs.info(
'PPT Table = ' +
current.getTableName()
);
gs.info(
'PPT Record = ' +
current.getUniqueValue()
);
6. Verify the template attachment
Open:
PowerPoint Management > PowerPoint Templates
Open your template and confirm:
- Exactly one .pptx attachment exists.
- The attachment is directly attached to the PowerPoint Template record.
- The file opens normally in Microsoft PowerPoint.
- File size is below 15 MB.
- The template references the correct Report Type.
ServiceNow supports one active .pptx attachment per PowerPoint Template.
7. Revisit the earlier GeneratePPTUtil errors
You previously received:
Cannot read property "isEncodedQuery" from undefined
and:
Cannot invoke GlideElement.getED() because this.fGlideElement is null
If the OOB control test works, these errors strongly point back to custom Report Type/template metadata.
Specifically review:
- Invalid field names
- Field removed after the template was created
- Incorrect Related Table
- Incorrect Parent relation column
- Formatter Mapping referencing a non-existent field
- Table/repeater referencing a table that is not configured in the Report Type
The GlideElement error is especially consistent with the generator attempting to resolve metadata for a field that it cannot find.
8. Important clarification about the PowerPoint add-in
The add-in is useful and is the documented template-authoring experience, but the underlying sn_ppt_export capability itself is not limited to SPM/APM and PPTRequestHandler can be called from other tables.
ServiceNow has also published a current employee-authored example demonstrating PPTRequestHandler on arbitrary tables.
Since your organization does not permit the add-in, I would start by copying a known-good OOB template and modifying it incrementally.
That is much safer than trying to reverse-engineer the protected POI generation code.
9. Verify POI Service availability
Export to PowerPoint depends on:
Export to PowerPoint:
sn_ppt_export
POI Service:
com.snc.poi_service
Your debugger already shows:
com.snc.poi_service.POIMain
so the POI component is present.
However, successful generation also depends on the ServiceNow-side PPT processing service being available for your hosting environment.
ServiceNow documentation specifically notes restrictions for some regulated, self-hosted, or otherwise restricted environments.
If the OOB export fails in exactly the same clientUtil.generate() call, ask Now Support to verify:
- POI service availability for your instance
- Data-center support
- sn_ppt_export version
- com.snc.poi_service status
- PPT service-side errors
- Any applicable PRB/KB for your release
Include the failed record from:
sn_ppt_export_ppt_poi_service_request_log
in the Support case.
My recommended troubleshooting path is now:
PPTRequestHandler reached successfully
-> Capture ex.message
-> Test OOB PowerPoint export
-> If OOB fails: POI/service/environment issue
-> If OOB works: custom Report Type/template issue
-> Test minimal Operational Resilience template
-> Add components back individually
I would not spend more time changing the UI Action until this OOB control test is completed. Your debugger already demonstrates that execution has passed the UI Action and entered the PowerPoint generation service.
Official references:
Export to PowerPoint overview:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
Upload PowerPoint Template:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
Current ServiceNow Employee article showing PPTRequestHandler for custom tables:
https://www.servicenow.com/community/developer-articles/export-to-powerpoint-in-servicenow-from-plat...
I would specifically check ex.message and run the OOB control test next. Those two checks should tell you whether this is a POI service issue or a custom Operational Resilience template issue.
Hope this helps!
If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.
Kind Regards,
Abhishek Pal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Abhishek Pal , thanks for your professional answer. I tried the test above and it still doesn't work.
here are the logs after test.
I didn't find the request log message 'Template not found' from the OOB script and the template sys_id does exist.
I also tried the same in my PDI. I just uploaded the blank template but it failed.
I am not sure which step I miss now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LimingWu ,
Thanks for performing the OOB test and sharing the new logs.
This test is actually very useful because it changes the conclusion.
You tested the OOB:
Project Status Report Template - default
and it also failed with:
Template not found
Therefore, I would stop troubleshooting the Operational Resilience UI Action for now.
Your custom UI Action is reaching PPTRequestHandler correctly. The same failure with an OOB Report Type and OOB template indicates that the issue is occurring before your custom Operational Resilience configuration is processed.
The first thing to understand is:
"Template not found" does not necessarily mean that the sn_ppt_export_ppt_template record does not exist.
The PowerPoint generation service also needs the actual .pptx attachment stored against that template record.
So please check the following.
1. Verify the actual PPTX attachment
Open:
PowerPoint Management > PowerPoint Templates
Open:
Project Status Report Template - default
Then check Manage Attachments.
There should be exactly one valid .pptx file attached directly to the PowerPoint Template record.
ServiceNow supports only one .pptx attachment per PowerPoint Template and the file must be no larger than 15 MB.
You can also verify this from sys_attachment.
Run the following read-only Background Script:
var templateId = 'YOUR_TEMPLATE_SYS_ID';
var template = new GlideRecord('sn_ppt_export_ppt_template');
if (!template.get(templateId)) {
gs.info('Template record NOT found');
} else {
gs.info(
'Template record found: ' +
template.getDisplayValue()
);
var att = new GlideRecord('sys_attachment');
att.addQuery(
'table_name',
'sn_ppt_export_ppt_template'
);
att.addQuery(
'table_sys_id',
templateId
);
att.query();
var count = 0;
while (att.next()) {
count++;
gs.info(
'Attachment: ' +
att.getValue('file_name') +
' | Type: ' +
att.getValue('content_type') +
' | Size: ' +
att.getValue('size_bytes') +
' | Sys ID: ' +
att.getUniqueValue()
);
}
gs.info(
'Total template attachments: ' +
count
);
}
Expected result:
Template record found
+
Exactly one .pptx attachment
If the template record exists but there is no .pptx attachment, that explains the "Template not found" error.
Do not manually create attachment metadata.
Instead, upload a valid .pptx through:
PowerPoint Template
-> Manage Attachments
and Update the template.
2. Check the OOB Project Status Report Template
This is more important than checking your POC template.
Since this is an OOB template, verify whether the OOB template itself has its original .pptx attached.
If the OOB template record exists but its attachment is missing, the Export to PowerPoint application may not have been completely installed/updated.
In that situation, I would check the installed application/plugin versions rather than rebuilding the OOB template manually.
Verify:
Export to PowerPoint
sn_ppt_export
POI Service
com.snc.poi_service
Also verify the applicable SPM PowerPoint application if you are testing the OOB Project Status Report.
3. Download the attachment manually
If a .pptx attachment exists:
Download it directly from the PowerPoint Template record.
Confirm that:
- PowerPoint can open the file.
- It is actually a .pptx file.
- It is not corrupted.
- It is below 15 MB.
Then upload it back to a new test PowerPoint Template if required.
4. Your blank PDI template test is useful
You mentioned that you uploaded a blank PowerPoint template in your PDI and still received the failure.
If the PDI test also produces:
Template not found
verify that the blank .pptx is attached to:
sn_ppt_export_ppt_template
and not to:
PowerPoint Report Type
Current record
UI Action
or another table.
The attachment relationship must be:
sys_attachment.table_name =
sn_ppt_export_ppt_template
sys_attachment.table_sys_id =
<PowerPoint Template sys_id>
5. Check environment support
There is another important ServiceNow limitation to verify.
Export to PowerPoint is currently unavailable in some restricted hosting environments, including:
- FedRAMP
- NSC DOD IL5
- Australia IRAP-Protected data centers
- Self-hosted environments
- Other restricted environments
Note that:
Australia release
and:
Australia IRAP-Protected data center
are NOT the same thing.
If your instance is simply running the Australia family release, that is not a problem.
But if the instance itself is hosted in an Australia IRAP-Protected environment, Export to PowerPoint may not be available.
Please confirm this with your ServiceNow platform/account team.
6. The GeneratePPTUtil errors are probably secondary at this point
You are also seeing:
Cannot read property "isEncodedQuery" from undefined
and:
Cannot invoke GlideElement.getED() because this.fGlideElement is null
Earlier I would have investigated the Report Type/field mappings first.
However, now that:
Project Status Report Template - default
also returns:
Template not found
I would resolve the template retrieval/POI issue before investigating those errors.
Otherwise we may be debugging downstream processing while the PPT service has not successfully loaded the template.
7. Do one final OOB test
Use:
OOB Project Status Report Template - default
+
OOB Project Status Report / Project record
+
OOB Export to PowerPoint action
Do not use your custom UI Action for this test.
If that OOB scenario also produces:
Template not found
while the OOB template definitely has a valid .pptx attachment, I would open a Now Support case.
At that point you have a very clean OOB reproduction.
Provide Support with:
Application:
sn_ppt_export
Dependency:
com.snc.poi_service
Template:
Project Status Report Template - default
Request type:
Generate
Request status:
Failed
Message:
Template not found
Table:
sn_ppt_export_ppt_poi_service_request_log
Also provide:
- Release and patch
- sn_ppt_export version
- Hosting/data-center type
- Template sys_id
- sys_attachment sys_id
- Screenshot of the template attachment
- Failed PPT Service Request Log sys_id
This is much stronger than raising the case using your custom Operational Resilience implementation because you can now reproduce the failure entirely with OOB functionality.
My recommended troubleshooting order is now:
PPT Template record exists
-> Verify actual .pptx attachment
-> Verify attachment table/sys_id
-> Verify OOB template attachment
-> Verify sn_ppt_export and POI Service
-> Verify hosting eligibility
-> Test completely OOB export
-> If OOB still fails, open Now Support case
Only after the OOB Project Status Report generates successfully would I return to the Operational Resilience Report Type and template configuration.
So at this stage, I would not change PPTRequestHandler or your UI Action again.
Your test has already demonstrated that the problem exists below that layer.
Hope this helps!
If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.
Kind Regards,
Abhishek Pal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Abhishek Pal , I uploaded the blank template and it works. The current issue is simply that I can't use PowerPoint add-ins to create templates that dynamically retrieve values. I'll raise this to the team. Thanks a lot!