Support Article
IAC getGadgetData does not work in Pega 7.1.7
Summary
Within a PegaE event user is not getting any data back when using getGadgetData:
var pOp = pega.web.api.doAction(IACGaget, "getGadgetData", ".pxCreateOpName");
Error Messages
No script errors, function never returns data.
Steps to Reproduce
Using "getGadgetData" in IAC mash up page.
Root Cause
The problem was with this Javascript used:
var pOp = pega.web.api.doAction(IACGadget, "getGadgetData", ".pxCreateOpName");
The first parameter to the pega.web.api.doAction should be a string reference to a DIV element that has the same value in the PegaGadget attribute. The value passed above was actually the DOM reference to the DIV because it had an ID of IACGadget. This caused errors within the doAction method.
Resolution
Refer to PDN article for the Gadget Manager Reference:
https://pdn.pega.com/pega-web-mashup/gadget-manager-reference-for-pega-web-mashup#getgadgetdata
After following the Gadget Manager Reference PDN article, user must modify the Javascript to resolves the issue.
Following is the modification for the Javascript:
var pOp = pega.web.api.doAction("IACGadget", "getGadgetData", ".pxCreateOpName");
Adding the double quotes turned the parameter into a string and the doAction method worked properly.
The gadget name is also the first parameter sent into any PegaE event so the code could also be written like:
function pegaOnConfirm(gadgetName){
var pOp = pega.web.api.doAction(gadgetName, "getGadgetData", ".pxCreateOpName");
}
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.