Question

How to invoke JS file from Pega

I would like to know how to invoke custom JS file on local machine, want to invoke by a button click on UI.

Thanks.

Comments

Keep up to date on this post and subscribe to comments

Pega
September 28, 2019 - 6:37pm

Suppose that your custom JS file is under webwb. You can add JS file in the harness (under "Scripts & styles" tab) where your button section resides. Configure the button click action as 'Run Script' to invoke the function defined in your custom JS file. 

 

Pega
September 29, 2019 - 12:18am

September 29, 2019 - 12:30am

In Addition to Susan's comment, you can also add the script in the HTML fragment 'UserWorkForm' and then call the function by configuring "Run Script" on click of the button.

If you want to use this JS application wide then please check the below dicussion:

https://community1.pega.com/community/pega-product-support/question/best-place-include-javascript-function