Support Article

Mashup: getGadgetData, setGadgetData, getGadgetInfo not working

SA-54563

 

Summary

Using Pega Mashup and getGadgetData or SetGadgetData not working.

 

Error Messages

Not Applicable
 

Steps to Reproduce

  1. Create a harness containing a property (for example, City).
  2. Add the City property as Data Field in the Harness.
  3. Create one html page as shown in the html.
  4. Include the Page harness in the above html using Pega Mashup.
  5. Try to copy the Harness property value to the field in the host page (html), not working.
  6. Try to set the value to a property in the harness, but not working.
     

Root Cause

The documentation here https://pdn.pega.com/pega-web-mashup-page-javascript-actions/pega-web-mashup-page-javascript-actions  is out dated.

The API for getGadgetData, setGadgetData and getGadgetInfo has changed as of Pega 7.2.1 and the documentation changes are not yet complete on PDN.

 

Resolution

Similar to https://pdn.pega.com/support-articles/getgadgetdata-always-returns-undefined-when-using-mashup
 

Pega now uses Window post messages for communication from top level application to PRPC. The nature of this change requires callback functions.

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

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

pega.web.api.doAction("GADGETNAME", "getGadgetInfo", {callback:function(){},scope:scope});

 

Example: getGadgetData:

function getTheGadgetData(){

    pega.web.api.doAction("GCSTestDataBind", "getGadgetData", "OperatorID.pyFirstName", {callback:callBackForFirstname});

}

function callBackForFirstname(rtnValue)

{

  alert("return value: " + rtnValue);

}

 

DataField not used anymore:
 

Also 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".

 

Application Integration and Security:

On the application record there is an Integration and Security tab that contains a “Mashup Security” section. This must contains the host site that is including the Mashup content.

Suggest Edit

Published July 23, 2018 - Updated February 4, 2021


100% found this useful

Have a question? Get answers now.

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