How to export to PowerPoint in Operational Resilience Worskspace
- 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.
do anyone try to export to PowerPoint in Operational Resilience Worskspace? If it works, could you please share your experience please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LimingWu ,
Yes, you can generate PowerPoint from Operational Resilience records using the OOB Export to PowerPoint capability. However, Operational Resilience Workspace does not provide an OOB "Export to PowerPoint" button like SPM/APM, so you need to expose the generator through a Workspace-compatible UI Action.
Your use of:
sn_ppt_export.PPTRequestHandler
is the correct API.
There are a few important configuration points to verify.
1. Create a PowerPoint Report Type
Navigate to:
PowerPoint Management > PowerPoint Report Types
Create a Report Type with the Operational Resilience table as the main table.
For example:
Main table:
sn_oper_res_scenario_analysis
Use your actual Operational Resilience table name.
Add Related Tables if the PowerPoint needs data from child/related records.
2. Create the PowerPoint Template
Navigate to:
PowerPoint Management > PowerPoint Templates
Create the template record and associate it with the Report Type created above.
Important:
Creating only the ServiceNow template record is not enough.
The template record must have a valid .pptx file attached containing the ServiceNow placeholders.
For example:
${sn_oper_res_scenario_analysis.number}
${sn_oper_res_scenario_analysis.short_description}
You do not need the Microsoft PowerPoint add-in to execute the export. The add-in mainly helps with authoring templates.
If your organization cannot install the add-in, you can still create/edit a normal .pptx file manually using the supported placeholder syntax and attach it to the PowerPoint Template record.
I recommend copying an existing OOB PowerPoint template first and modifying it rather than building the first template completely from scratch.
3. Correct your UI Action script
One issue visible in your screenshot is:
var pptName = 'test';
The generated filename should include the .pptx extension.
Use:
var pptName = 'Scenario_Analysis_' + current.getDisplayValue() + '.pptx';
Example server-side UI Action:
var templateId = 'YOUR_PPT_TEMPLATE_SYS_ID';
var tableName = current.getTableName();
var recordSysId = current.getUniqueValue();
var fileName =
'Scenario_Analysis_' +
current.getDisplayValue() +
'.pptx';
try {
var ppt =
new sn_ppt_export.PPTRequestHandler(templateId);
var attachmentSysId =
ppt.runPPTGenerator(
tableName,
recordSysId,
tableName,
recordSysId,
fileName
);
if (attachmentSysId) {
gs.addInfoMessage(
'PowerPoint generated successfully and attached to this record.'
);
} else {
gs.addErrorMessage(
'PowerPoint generation did not return an attachment.'
);
}
} catch (ex) {
gs.error(
'Operational Resilience PPT generation failed: ' +
ex.message
);
gs.addErrorMessage(
'PowerPoint generation failed. Please check the system logs.'
);
}
action.setRedirectURL(current);
The parameters are:
runPPTGenerator(
sourceTable,
sourceRecordSysId,
attachmentTable,
attachmentRecordSysId,
outputFileName
)
So if you want the generated PPT attached to the same Operational Resilience record, using the same table/sys_id for both pairs is correct.
4. Configure the UI Action for Workspace
For the UI Action verify:
Active = true
Form button = true
Workspace Form Button = true
Format for Configurable Workspace = true
Keep the server-side generation logic in the UI Action.
Do not clone or modify the Operational Resilience Workspace page just to generate the PPT.
5. Verify the template attachment
Before testing the UI Action, confirm there is a .pptx attachment on:
sn_ppt_export_ppt_template
for your template sys_id.
This is a common reason for PPTRequestHandler returning nothing.
Also make sure there is only the intended/current PowerPoint template attachment.
6. Check the PPT Service Request Log
Navigate to:
PowerPoint Management > PPT Service Request Logs
Table:
sn_ppt_export_ppt_poi_service_request_log
This is one of the first places I would check if runPPTGenerator() executes but no attachment is produced.
Also check:
System Logs > All
for errors containing:
PPT
PPTRequestHandler
POI
sn_ppt_export
7. Verify roles
The user generating or managing PowerPoint reports should have the required Export to PowerPoint roles.
For example:
sn_ppt_export.ppt_user
For configuration/admin activities:
sn_ppt_export.ppt_admin
8. Check cross-scope access
Since your UI Action is in the Operational Resilience application scope and PPTRequestHandler belongs to:
sn_ppt_export
check the system logs for cross-scope errors.
If you see an error such as:
Access to Script Include denied from scope...
review:
System Applications > Restricted Caller Access
or:
sys_scope_privilege.list
Do not modify the OOB PPTRequestHandler Script Include.
Only create the required cross-scope access record if ServiceNow generates an allowed/requested access entry and your application governance permits it.
Recommended architecture:
Operational Resilience record
-> Workspace UI Action
-> sn_ppt_export.PPTRequestHandler
-> PowerPoint Report Type
-> PowerPoint Template
-> POI Service
-> Generated .pptx
-> Attachment on Operational Resilience record
The Microsoft PowerPoint add-in is therefore not required for the actual server-side generation.
The first things I would fix/check in your current implementation are:
1. Change:
var pptName = 'test';
to:
var pptName = 'test.pptx';
2. Verify the template record has a valid .pptx attached.
3. Verify the template points to a Report Type whose main table is your Operational Resilience table.
4. Verify the UI Action is enabled for Configurable Workspace.
5. Check PPT Service Request Logs and cross-scope errors.
There is also a recent ServiceNow Employee article showing the same PPTRequestHandler pattern being used for arbitrary tables, confirming that Export to PowerPoint is not limited to SPM/APM records:
Related accepted Community example using PPTRequestHandler from a custom UI Action:
Official documentation:
PowerPoint Templates:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
PowerPoint Report Type / Related Tables:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
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 , appreciate for your patient and detailed reply. It's very helpful. I also try the code you provided. And I found it is still failed and some logs are shown such as 'LOG: GeneratePPTUtil Cannot read property "isEncodedQuery" from undefined', 'LOG: GeneratePPTUtil Cannot invoke "com.glide.script.GlideElement.getED()" because "this.fGlideElement" is null '. I am not sure which step is wrong and I am still checking it. Could you kindly advise on this please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @LimingWu ,
Thanks for sharing the logs. Based on these errors, I would adjust my previous recommendation.
Your UI Action is reaching PPTRequestHandler successfully. The PPT Service Request Log shows a Generate request for your "POC test" template, so the current problem is no longer the Workspace UI Action.
The issue is with the PowerPoint template / Report Type configuration.
The two errors are strong indicators of that:
LOG: GeneratePPTUtil Cannot read property "isEncodedQuery" from undefined
This normally occurs when the template contains a Table/Repeater element for which the PPT engine cannot find a valid Related Table relationship in the configured PowerPoint Report Type.
LOG: GeneratePPTUtil Cannot invoke "com.glide.script.GlideElement.getED()" because "this.fGlideElement" is null
This normally indicates that the PPT engine is trying to resolve a field that does not exist on the table being processed. This can come from an invalid template token or an invalid Formatter Mapping.
Also, your PPT Service Request Log shows:
Template not found
I would troubleshoot in this order.
1. Verify the actual PPTX attachment
Open:
PowerPoint Management > PowerPoint Templates > POC test
Confirm that:
- The template is linked to "Test Report".
- Exactly one .pptx file is attached directly to the PowerPoint Template record.
- The file is a valid PowerPoint .pptx file.
- The attachment is less than 15 MB.
ServiceNow supports only one active PPTX attachment per PowerPoint Template record.
You can confirm it from sys_attachment:
Table name:
sn_ppt_export_ppt_template
Table sys ID:
<sys_id of POC test>
If there is no matching attachment, delete/re-upload the PPTX and save the template.
2. Verify the Report Type
Open:
PowerPoint Management > PowerPoint Report Types > Test Report
The Main table must be the same table you pass as the first parameter to runPPTGenerator.
For example, if the Operational Resilience record is:
sn_oper_res_scenario_analysis
then configure:
Main table:
sn_oper_res_scenario_analysis
and call:
var tableName = 'sn_oper_res_scenario_analysis';
var handler =
new sn_ppt_export.PPTRequestHandler(pptTemplateId);
var attachmentId = handler.runPPTGenerator(
tableName,
current.getUniqueValue(),
tableName,
current.getUniqueValue(),
'Scenario_Analysis.pptx'
);
Do not pass a table label such as:
Scenario Analysis
It must be the actual database table name.
3. Check every Related Table
This is particularly important because of the:
isEncodedQuery from undefined
error.
If your PPT contains a Table or Repeater for a child table, that table must be configured under:
Test Report
-> Related Tables
For every Related Table verify:
Name:
Correct child table
Parent relation column:
A real reference field on the child table that points back to the parent record
For example:
Parent:
sn_oper_res_scenario_analysis
Child:
<your related table>
Parent relation column:
<reference field on child pointing to scenario analysis>
If the PPT references a child table but no matching Related Table configuration exists, the PPT engine cannot determine how to query the child records.
For the first test, I recommend removing all Related Tables, Repeaters, Tables, Charts and Formatter Mappings.
Test only one field from the main record.
4. Validate the PPT template tokens
The second error:
GlideElement.getED() ... fGlideElement is null
usually means the generator received a field name that it cannot resolve.
Check every token in the PPT.
For example:
${sn_oper_res_scenario_analysis.number}
is valid only if:
Table:
sn_oper_res_scenario_analysis
Field:
number
actually exists.
If you have something such as:
${sn_oper_res_scenario_analysis.status_name}
but status_name is not a real dictionary field, the generator can fail while trying to retrieve its field metadata.
Also check:
PowerPoint Management > PowerPoint Formatter Mapping
Make sure there is no Formatter Mapping pointing to a deleted/non-existent field.
5. Important correction regarding manually created PPT templates
This may actually be the most important point in your scenario.
The PowerPoint add-in is not required to execute:
PPTRequestHandler.runPPTGenerator()
However, ServiceNow's supported process for authoring a PowerPoint template uses the Microsoft PowerPoint add-in.
The add-in does more than display the placeholder text. It creates the ServiceNow token/link metadata that the PPT parser uses to understand:
- Report Type
- Table
- Field
- Related Table
- Filters
- Repeater information
- Sorting
- Maximum rows
Therefore, simply typing something such as:
${sn_oper_res_scenario_analysis.number}
into a normal PowerPoint text box is not necessarily equivalent to a token generated by the ServiceNow add-in.
This could explain the errors you are currently receiving.
Since your organization does not allow the add-in, I would recommend one of these approaches:
Preferred:
Ask your Microsoft 365/security team to allow the ServiceNow PowerPoint add-in for a controlled template-authoring user.
The add-in does not need to be deployed to every Operational Resilience user. It is primarily required by the person creating/managing the template.
Alternative:
Start from an OOB ServiceNow PowerPoint template that is already valid and use it as a technical reference.
Do not build the first PPT completely from a blank PowerPoint file.
I would not attempt to manually recreate the undocumented token/link metadata unless ServiceNow Support confirms that approach is supported.
6. Perform a minimal test
Before adding the full Operational Resilience report, create the smallest possible test:
Report Type:
Test Report
Main table:
sn_oper_res_scenario_analysis
Related Tables:
None
Formatter Mappings:
None
Charts:
None
Repeaters:
None
PPT:
One slide with one valid field token generated using the supported template-authoring mechanism.
Then run:
var templateId = 'POC_TEST_TEMPLATE_SYS_ID';
var tableName = 'sn_oper_res_scenario_analysis';
var gr = new GlideRecord(tableName);
gr.get('VALID_SCENARIO_ANALYSIS_SYS_ID');
if (gr.isValidRecord()) {
var handler =
new sn_ppt_export.PPTRequestHandler(templateId);
var attachmentId = handler.runPPTGenerator(
tableName,
gr.getUniqueValue(),
tableName,
gr.getUniqueValue(),
'PPT_Test.pptx'
);
gs.info('Generated attachment: ' + attachmentId);
}
If this works, add the components back one at a time:
Main table fields
-> Related Table
-> Table token
-> Repeater
-> Formatter
-> Chart
This will identify exactly which component is producing the failure.
So based on the new logs, I would not change the UI Action again.
The investigation should now focus on:
PPTX attachment
-> Report Type main table
-> Related Table relationship
-> Valid field tokens
-> Formatter mappings
-> Template token metadata
Most importantly, because you created the template without the Microsoft add-in, validate the template-authoring method first. The official ServiceNow process uses the add-in to generate the tokens used by the PPT parser.
Official references:
Create a Microsoft PowerPoint template:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
Upload a PowerPoint template:
https://www.servicenow.com/docs/r/zurich/it-business-management/export-to-powerpoint-for-application...
Manage Related Tables:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
Related Tables configuration:
https://www.servicenow.com/docs/r/it-business-management/export-to-powerpoint-for-application-portfo...
I would start with the minimal one-field template test above. If that works, your PPTRequestHandler/UI Action is confirmed and the failing Related Table/token can then be isolated very quickly.
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