Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Want my server script to run once action is made from client side in Service Portal.

Nikhil G_
Tera Contributor

Hi All,

 

I am working on a widget for the service portal. I have server-side code with a REST message that I want to execute with ng-click. But my requirement is that server-side scripts should only run when some action is performed on the client side. When a user clicks the button on the browser, only then should the server script run. I am able to execute it from server to HTML, but I am finding it difficult to find a connection between the client server and HTML.

Please guide.

1 REPLY 1

kamlesh kjmar
Mega Sage

Hi @Nikhil G_ ,

 

You can user server.update() method from client script to invoke server script. You can reference the below link to go through a quick demo of how to use it :

 

https://www.youtube.com/watch?v=sr_gqqxllRM

 

I hope this help.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh