Is there a server-side script mechanism to run generate HTML from a Template (Jelly or other) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 02:34 AM
I am looking at how we might create templated output as a PDF report in our Scoped Application.
I can see that I can use the PDFGenerationAPI - however this requires HTML input.
So I was wondering if it was possible to use a Server-side templating engine (possibly Jelly-based?) to allow production of the HTML from template with boiler plate HTML and embedded scripting.
As far as I can see the normal usage of Jelly is in UI Pages, which are used for web request handling (HTML straight back to browser) and may not be accessible from a scripting usage. But is there an equivalent?
I'm going to take a look at using standard Template Strings (ECMAScript 2021) [like this] but wondering if there is a better alternative.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 03:38 AM
Hello,
In a ServiceNow Scoped Application, creating templated PDF output involves generating HTML content that can be passed to the PDFGenerationAPI. While your ideas around server-side templating (e.g., Jelly-based solutions or ECMAScript template strings) are viable, let’s examine practical approaches to achieve this:
1. Jelly-Based Templates
Jelly Limitations: Jelly templates are primarily designed for use in UI Pages and are typically tied to user-interface rendering. While you could theoretically use Jelly to generate server-side HTML, it’s not natively designed for scripting usage outside of its UI context.
Custom Implementations: If you want to use Jelly, you could define Jelly templates as part of the application’s metadata (e.g., stored in Script Includes or as static resources) and invoke them in a controlled manner using Jelly scripting. However, this might involve a lot of overhead, including parsing and managing the output yourself.
Best Regards
merry867
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 05:13 AM
Hi
Thanks - yes, I think Jelly may be a bit clunky for this.
I guess I am trying to tease out whether these was an alternative feature - similar approach to Jelly (with html template and embedded script handling for data) in SN that I have missed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 05:23 AM
I don't think so there is an option here.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 09:11 PM
Hello,
I hope that u find good answer that i suggested.
unitedhealthcare login
Best Regards
merry678