Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to display a PPT as part of the widget?

vidhya_mouli
Tera Sage

I have a widget with the following code:

 

HTML:

<div>
<h1>
  Display PPT
  </h1>
    <p>  {{data.IncidentNumber}}  </p>
  
<div id="ppt-widget">
    <iframe src="$viewer.do?sysparm_stack=no&amp;sysparm_sys_id=f2253344830e42102a921630ceaad3d1" width="100%" height="100%"> </iframe>
  </div>

</div>

 

Server Script:

(function() {
    var incidentSysId = '35e47f48830e42102a921630ceaad374';
    var gr = new GlideRecord('incident');
    if (gr.get(incidentSysId)) {
        data.IncidentNumber = gr.getDisplayValue("number");
    } else {
        data.IncidentNumber = 'Incident not found';
    }

})();

 

However this is prompting me to download the presentation. I want to display it directly. How to do this?

1 ACCEPTED SOLUTION

vidhya_mouli
Tera Sage

Finally made it work:

Enabled document viewer and added this to the widget.


<div id="ppt-widget">
<iframe src='https://<<myinstance>>.service-now.com/$viewer.do?sysparm_stack=no&sysparm_sys_id=f2253344830e42102a921630ceaad3d1' width='100%' height='100%' frameborder='0'></iframe>
</div>

View solution in original post

6 REPLIES 6

Amitoj Wadhera
Kilo Sage

Hi @vidhya_mouli ,

 

You must use a compatible viewer that allows for the embedding of PowerPoint files if you want to display a PowerPoint presentation (PPT) inside a widget without requiring a download. Depending on the platform or viewer you are using, there may be different ways to achieve this.
For example, if you upload the presentation to OneDrive:

  • Upload the PPT file to one of these services and obtain an embeddable link.
  • Replace the src attribute in your iframe with the embeddable URL.

 

<div>
    <h1>Display PPT</h1>
    <p>{{data.IncidentNumber}}</p>
    <div id="ppt-widget">
        <iframe src="https://view.officeapps.live.com/op/embed.aspx?src=YOUR_PPT_FILE_URL" width="100%" height="100%"></iframe>
    </div>
</div>

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Regards,

Amitoj


 

Thank you. It helped and it works. But I have a follow up question. This file is attached to the incident and I will be displaying it in the portal. Is it possible to directly get the attachment and display it instead of uploading it somewhere else.

 

 

I used the following code, but getting an error:

<div id="ppt-widget">
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=https://myinstance/$viewer.do?sysparm_stack=no&sy...' width='100%' height='100%' frameborder='0'></iframe>
</div>

 

Hi @vidhya_mouli 

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Regards,

Amitoj

 

Not applicable

Hi @vidhya_mouli ,

Please check this article and please try to create link from here.

https://www.servicenow.com/community/now-platform-articles/open-files-with-document-viewer-at-table-...

 

Please mark my answer correct and helpful if this works for you 

 

Thanks and Regards 

Sarthak