Javascript APIs
Can some give a working example of a Javascript API?
For example:
refreshSection - API
var options = {
section: sectionName,
event: eventObject,
dataTransform: dataTransformJSObject,
activity: activityJSObject,
submitOnRefresh: booleanVal
};
pega.api.ui.actions.refreshSection(options);
Can someone give a working example of this syntax?
Thanks in advance.
Ratan
***Edited by Moderator Marissa to update platform capability tags; add SR Details****
-
Like (0)
-
Accepted Solution

Upon reviewing the associated Support Request, this is the resolution:
Perform the following local-change:
As per your requirement add type as button in the custom control. Please find the same below:
<button onclick="myFunction()" type=button>Click-----me</button>
Hi,
let me take the example of runDataTransform() API.
Here I want to trigger this to run one of my custom DT. The sample code will be something like this.
function onHarnessLoadHandler() {
Hi @Santanu,
Thanks for the quick reply. On implementing the same, i can see the below behaviour in Pega.
<button onclick="myFunction()">Click me</button>
<script>
function myFunction() {
var e = window.event;
var options = {
name: "TestDT",
event: e
};
pega.api.ui.actions.runDataTransform(options);
}
</script>
When i click the button, the javascript API gets executed but i can see that it not only executes the data transform but also tries to finish the assignment. So, the above code is not equal to refresh section and run data transform, but refresh section, run data transform and Finish assignment.
Hi @Santanu,
Thanks for the quick reply. On implementing the same, i can see the below behaviour in Pega.
<button onclick="myFunction()">Click me</button>
<script>
function myFunction() {
var e = window.event;
var options = {
name: "TestDT",
event: e
};
pega.api.ui.actions.runDataTransform(options);
}
</script>
When i click the button, the javascript API gets executed but i can see that it not only executes the data transform but also tries to finish the assignment. So, the above code is not equal to refresh section and run data transform, but refresh section, run data transform and Finish assignment.
Is this an expected behaviour?
Thanks in advance.
Ratan Balaji

Hi,
How did you included the js script in pega?
Which rule?
Hey @Santanu
Since you took the example of running a data transform at the java script level, i thought of trying the same. Instead of just running the data transform, the system tries to finish the assignment. Can you please run the code that i posted above to check why the system does a "Run data transform","finish assingment" instead of just "run data transform"? Also, the test data transform that i execute has "exit data transform" as the only step in it.

Hello @Ratan,
Do share the SR ID if you decide to create it. We will connect the SR with this post and track it for you.
Thanks,
Accepted Solution

Upon reviewing the associated Support Request, this is the resolution:
Perform the following local-change:
As per your requirement add type as button in the custom control. Please find the same below:
<button onclick="myFunction()" type=button>Click-----me</button>