Question

Pega Mashup: Passing Parameters to Mashup

Hello,
I am working on the pega mashup data passing requirement. I am trying to get communicate between external application and Pega Mashup.I have tried with Setgadgetdata method with onload event but it is not passing the data to Pega gadget.
I've been trying to use the JavaScript method of doAction, but most of the documentation is listed as outdated.

Below is the code used by me which is not working.

Please let me know if any one knows.

Thank you

Code :
======

<!DOCTYPE html>
<html>
<head>
<script>
function setMashupName() {
alert("hi");
pega.web.api.doAction("PegaGadget","setGadgetData","pyWorkPage.VendorID","v1111");
}
</script>
</head>
<body>
Enter Vendor id <input type="text" id="VendorID"/>
<button type="button">Click Me!</button>
<!-- ********************** Begin Pega content ********************** -->

<script src ='http://1/prweb?pyActivity=pzIncludeMashupScripts'></script>

<div data-pega-gadgetname ='PegaGadget'
data-pega-action ='createNewWork'
data-pega-action-param-classname =''
data-pega-action-param-flowname ='pyStartCase'
data-pega-isdeferloaded ='false'
data-pega-applicationname =''
data-pega-threadname ='STANDARD'
data-pega-resizetype ='stretch'
data-pega-action-param-parameters ="{pzSkinName : '' ,UserIdentifier:'',Password:btoa('')}"
data-pega-url =''
data-pega-event-onload = 'setMashupName'></div>
<!-- ********************** End Pega content ********************** -->
</body>
</html>

***Edited by Moderator Marissa to update SR Details***

Group Tags

Comments

Keep up to date on this post and subscribe to comments

Pega
April 5, 2019 - 12:04pm

First, you can't test this when loading a HTML file into the browser from your local machine.  The test has has to be serviced from a web server and that host added to your applications security/integration tab Mashup Security section. 

The API for setGadgetData has also changed in later releases of PRPC. If you are on 7.2.1 or later code uses this now:

pega.web.api.doAction("GADGETNAME", "setGadgetData", "[pyWorkpage.Property]", "value",{callback:function(){},scope:scope});

 

Example:

pega.web.api.doAction("PegaGadget","setGadgetData","pyWorkPage.VendorID","v1111",{callback:callBackForSetVendorID});

function callBackForSetVendorID(value){

//returns true/false. 

  console.log("status for setVendorID: " + value);  

}

 

 

June 24, 2019 - 12:23pm
Response to ChrisKoyl