Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

getGadgetData always returns undefined when using Mashup

SA-44737

Summary



getGadgetData always returns 'undefined'. Mashup is used to retrieve data from DataField in PRPC content using getGadgetData.

Code examples,


var firstName = pega.web.api.doAction("GCSTestDataBind", "getGadgetData", "[gadget/GCSTestDataBind/OperatorID.pyFirstName]");
var createOpName = pega.web.api.doAction("GCSTestDataBind", "getGadgetData", "[gadget/GCSTestDataBind/.pxCreateOpName]");


Syntax is as defined according to the PDN article: https://pdn.pega.com/pega-web-mashup-data-binding-syntax/pega-web-mashup-data-binding-syntax

Application record has the correct host names set in Mashup security section.


Error Messages



Not Applicable


Steps to Reproduce

  1. Configure the Simple Gadget: CreatNewWork - PegaSample-Task - BasicProcess
  2. Set the Data Fields present in New harness: OperatorID.pyFirstName
  3. Set the Data Fields present in Resolve Flow Action: .pxCreateOpName
  4. Use Mashup to retrieve data from DataField in PRPC content using getGadgetData


Root Cause



The PDN documentation listed above is incorrect.

Resolution



The use of getGadgetData requires the usage of a callback function:

pega.web.api.doAction("GADGETNAME", "getGadgetData", "[PropertyRefence]" {callback:function(){},scope:scope});

For example,
function getTheGadgetData(){
pega.web.api.doAction("GCSTestDataBind", "getGadgetData", "OperatorID.pyFirstName", {callback:callBackForFirstname});
}
function callBackForFirstname(rtnValue)
{
alert("return value: " + rtnValue);
}


Additionally, as of Pega 7.2.1, DataField controls are no longer used for getGadgetData. Instead use a simple hidden input element using the control, Hidden Input.

Published October 25, 2017 - Updated October 8, 2020

Was this useful?

50% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us