Question

Javascript APIs

Can some give a working example of a Javascript API?

For example:

refreshSection - API

  1. var options = {
  2. section: sectionName,
  3. event: eventObject,
  4. dataTransform: dataTransformJSObject,
  5. activity: activityJSObject,
  6. submitOnRefresh: booleanVal
  7. };
  8. 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****

Group Tags

Correct Answer
July 10, 2019 - 3:07pm

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>

Comments

Keep up to date on this post and subscribe to comments

Pega
February 11, 2019 - 6:03am

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() { 

  var e = window.event;

var options = {

name: "UpdateCustomerList",

        event: e

    };

 

  pega.api.ui.actions.runDataTransform(options);

}

 

 

February 21, 2019 - 7:34am
Response to Santanu

Hi @Santanu,

Thanks for the quick reply. On implementing the same, i can see the below behaviour in Pega.

  1. <button onclick="myFunction()">Click me</button>
  2. <script>
  3. function myFunction() {
  4. var e = window.event;
  5. var options = {
  6. name: "TestDT",
  7. event: e
  8. };
  9. pega.api.ui.actions.runDataTransform(options);
  10. }
  11. </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

August 3, 2019 - 3:13am
Response to Ratan

Hi,

How did you included the js script in pega?

Which rule?

Pega
February 25, 2019 - 7:09am

Hi

I tried similar code and cant see the refresh section happening. What your data transform is trying to perform at your end?

February 25, 2019 - 11:50pm
Response to Santanu

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.

Pega
March 6, 2019 - 7:02am

Yeah, found similar issue as reported by you. I recommend you to raise an SR and let our support professional review and debug it further. 

March 6, 2019 - 7:54am

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,

Pallavi | Community Moderator | Pegasystems Inc.

April 1, 2019 - 12:21pm
Response to Pallavi_Mandal

Hi @Pallavi_Mandal,

I have raised an SR (SR-D4389) for the issue reported.

Thanks.

June 12, 2019 - 9:33pm

July 10, 2019 - 3:07pm

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>

Marissa | Community Moderator | Pegasystems Inc.