Calling a client script from a button onclick in a HTML form

Garrett Boren
Kilo Explorer

Hello, I am working on an integration, that part of it requires a REST API post request to an external API be made when a button is pressed in a custom HTML field associated with an Incident. This HTML field is populated by a Business rule that runs when an incident is created, which populates data from one of our APIs into this custom HTML (this all works fine).

How I believe this should be done is to have a client script that is called by the button onclick function in the HTML field that then makes a GlideAJAX call (as I have to gather some system properties to determine the authentication and endpoint to use for the subsequent REST request) which will then make the final REST post call to another one of our APIs to kick off an automation on our system. However when I try to do this (after whitelisting the onclick function in the HTML sanitizer), clicking on the button does not trigger the Client script that I have written, it just says the function name is not defined.

If anyone has insight on buttons within a HTML field I would appreciate it, as I was basing this on another thread I found here that seems like this should be possible.

1 REPLY 1

Hrushidhar Ina2
Kilo Contributor

Hi 

If we want to call the REST API you can call directly through the UI ACTION button using Ui action Script 

No need of using client script, business rules, and GLIDE AJAX

 

Mark this as correct answer if it is useful/ Mark Helpful If you get an idea

Regards 

Hrushidhar