Question
BOA
IN
Last activity: 18 Apr 2022 6:22 EDT
JS function written in text file not getting triggered
Hi Team,
I wrote a function in text file of type js and i am calling on a button on click with "RunScript" event. Its not getting triggered how can i debug or please suggets fix.
PFA document.
***Edited by Moderator Marije to add Capability tags***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 18 Apr 2022 6:22 EDT
moj.gov.sa
GB
You have to include the text file in harness in script and styles tab where you want to test the function or userworkform for all harness , so that your function is visible while executing...
Updated: 14 Apr 2022 10:02 EDT
Pegasystems Inc.
GB
@Pavani_Regulagedda the issue may be due to a BAC feature to enhance security of Pega applications . We need to verify the request for custom controls, custom java in activities, etc.. to overcome this issue. The following help document should be helpful on how to register custom controls.
Verifying requests when using custom controls | Pega
Please can you go through the below PCC posts which all have similar symptoms and some troubleshooting suggestions:
Run Script Function call not happening on Link click after upgrade from 8.3 to 8.6
Function not working on Run script for Pega 8.2
Run Script action is not working on click event
Run Script OnClick Section Not Working. Nothing Is Executing.
Where can we configure functions for Run Script action
On Click of Button using Run script
@Pavani_Regulagedda the issue may be due to a BAC feature to enhance security of Pega applications . We need to verify the request for custom controls, custom java in activities, etc.. to overcome this issue. The following help document should be helpful on how to register custom controls.
Verifying requests when using custom controls | Pega
Please can you go through the below PCC posts which all have similar symptoms and some troubleshooting suggestions:
Run Script Function call not happening on Link click after upgrade from 8.3 to 8.6
Function not working on Run script for Pega 8.2
Run Script action is not working on click event
Run Script OnClick Section Not Working. Nothing Is Executing.
Where can we configure functions for Run Script action
On Click of Button using Run script
Open a function written on Run script
Your script appears to be wanting a website to be launched using the "Chrome" browser: please see the SME recommendations in the below post:
How to open a URL in internet explorer from chrome browser
Can you do a search for your function "OpenEdge" in Designer Studio search field? It should be in one of your JS files.
You can also run Fiddler or F12 (Developer tools) to capture the JS file. ---> that is your best troubleshooting method.
Analyzing your browser network logs will confirm whether you are running into the issues described in the above PCC posts. CHeck browser console for any errors while clicking on the link? and if there are any errors, resolving them will help here.
Accepted Solution
Updated: 18 Apr 2022 6:22 EDT
moj.gov.sa
GB
You have to include the text file in harness in script and styles tab where you want to test the function or userworkform for all harness , so that your function is visible while executing...
BOA
IN
@Mukesh-Agrawal Can you tell me how to add in user work form.
Pegasystems Inc.
IN
Userworkform might not be available as HTML rules are deprecated now.
You can add your custom JS file to the harness (under Scripts and Styles TAB) as mentioned by @Mukesh-Agrawal .
Also, check the checkbox for "Register OOTB actions used in script for URL tamper proofing" under the LINK configuration > Run script action set.
You can always use console.log or debugger statements in order to debug your javascript code.
Please test the scenario after updating the harness and checkbox.
Also, let us know if the issue still persists.
Kindly attach error screenshots if you observe any.
Hope this helps!
Thanks and Regards
Dipti Aggarwal
Updated: 18 Apr 2022 1:44 EDT
BOA
IN
@aggad ,@Mukesh-Agrawal Thank you for ur response. Now i have 2 issues. Can you help team.
1. I am unable to read values from clipboard using below syntax. Its giving me the code instead of value.
var appURI = tools.findPage("pxRequestor").getProperty("pxReqContextURI");
2.Below syntax not working from chrome, where as working in IE.
var shell = new ActiveXObject("WScript.Shell"); shell.run(URL)
Pegasystems Inc.
IN
Can you please confirm that the initially mentioned issue is resolved and you are able to trigger the script now?
You can refer to the code present in the below-mentioned OOTB rules to get the "pxReqContextURI" value from the clipboard.
1. pySetRedirectURI (Activity)
2. pzCaptcha (Control)
If the issue is not related to the above query, we request you to create a new question thread.
Also, I believe "ActiveXObject" is only applicable for Microsoft products(hence working in IE). Kindly look into alternatives to achieve the desired functionality. As this is not related to Pega products, reach out to general forums for more information.
BOA
IN
@Dipti Aggarwal Original issue is resolved. I kept alert in the js file and added js in my harness. On click addedRun script, i see the alert when triggered from IE. However i am stuck with above 2 issues.
function OpenEdge() { alert("Hello");
}