Load UI page HTML via server side

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 06:24 PM
Hello,
We're trying to load a UI page and consume the HTML content from server-side code - is this possible? Was considering doing it with REST but the only two REST interfaces I know so far are Table API and Custom REST, neither of which can be used on a UI page.
Any thoughts? Javascript libraries we can use?
Thanks!
Jeremy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 07:40 PM
Thanks Jeremy.
I'll going to assume that the UI page is invoked due to an action from a user.
In such case, the logic will be something like the following:
a) the UI page grabs the data through GlideAjax and produces the respective html. - if i'm understanding correctly you're all good on this first step.
b) the UI page once it completes producing its html it should take the entire html as a string and send it over through GlideAjax to either a Script Include that will store the html so that it later can be used by the scheduled job - Yeap. That can be accomplished through GlideAjax.
c) The schedule job will later call a script include (which could be the same as the one invoked by the UI page) function will take care of passing the stored html information to the third party system calling its API.
do i got your use case/thoughts right?
Now... to be honest, this is not how normally this is done. Often, on situations where a html needs to be produced and share with other systems, the html is actually produced at the server side. That way we can take the html and send it right away to the third party system, or it can be stored as needed within the server-side for later use (by the scheduled job) if needed or it can be produce by schedule job by demand when the schedule job runs.
Does this makes sense?
Thanks,
Berny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 07:45 PM
Actually, it's the "UI page is invoked due to an action" part that I am trying to figure out.
Consider it an external webpage not on ServiceNow, is there a way via server side to load an external webpage?
(We need several client side libraries to format the data, doing so server-side would be more complex. Perhaps we end up going that route, but trying to leverage formatting already contained client-side in UI page.)
Thanks,
Jeremy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 07:56 PM
Oh. I see.
You will need some sort of dedicated machine which sole responsibility is to do that via some sort of client app or script. The app or script will need to manually invoke the url of the ui page (of course, it also need to authenticate to the instance)
Something like selenium cucumber could help you out.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 08:02 PM
Now... I understand your dependency on the "client-side" libraries. I have been there before
as friend... i do will encourage you to look to do it just at the server side. Because having these automated routines at the client side within a browser always come with some risks and often are not as reliable as how it should be for a production quality system.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 08:03 PM
I hope this helps jeremy.gardner. Hopefully the selenium cucumber product is the right solution for you