doAction returns null using getGadgetInfo and getGadgetData in pega 7.3. What am I missing?
I have tried the functions in the following ways and all return null:
- var gadgetInfo = pega.web.api.doAction("PegaGadget", "getGadgetInfo")
- var gadgetData = pega.web.api.doAction("PegaGadget", "getGadgetData", ".pyID")
- var gadgetData = pega.web.api.doAction("PegaGadget", "getGadgetData", "[gadget/PegaGadget/.pyID]")
- var gadgetData = pega.web.api.doAction("PegaGadget", "getGadgetData", "pyWorkPage.pyID")
After tracing both with web inspector, I was able to get the information from getGadgetInfo if I change the pega.web.isWebMashup to false. But that didn't work with getGadgetData.
The function _doApiAction path uses 'postActionToGadget' instead of '_getGadgetInfo()':
if (pega.web.isWebMashup == true && this._isGadgetAction(A)) {
this._postActionToGadget(B);
return
}
...
case "getgadgetinfo":
return this._getGadgetInfo();
case "getgadgetdata":
return this._getGadgetData(B[2]);
Post action takes it to:
pega.Mashup.Communicator.send(D, B) sends information what seems to be a JSON object:
{payload: X, uid: V, src: W, target: U.target}
X = {gadgetName: "PegaGadget", name: "getGadgetInfo"}
V = "HostPage108"
W = "HostPage"
U = {target: "PegaGadgetIfr"}
I have tried the functions in the following ways and all return null:
- var gadgetInfo = pega.web.api.doAction("PegaGadget", "getGadgetInfo")
- var gadgetData = pega.web.api.doAction("PegaGadget", "getGadgetData", ".pyID")
- var gadgetData = pega.web.api.doAction("PegaGadget", "getGadgetData", "[gadget/PegaGadget/.pyID]")
- var gadgetData = pega.web.api.doAction("PegaGadget", "getGadgetData", "pyWorkPage.pyID")
After tracing both with web inspector, I was able to get the information from getGadgetInfo if I change the pega.web.isWebMashup to false. But that didn't work with getGadgetData.
The function _doApiAction path uses 'postActionToGadget' instead of '_getGadgetInfo()':
if (pega.web.isWebMashup == true && this._isGadgetAction(A)) {
this._postActionToGadget(B);
return
}
...
case "getgadgetinfo":
return this._getGadgetInfo();
case "getgadgetdata":
return this._getGadgetData(B[2]);
Post action takes it to:
pega.Mashup.Communicator.send(D, B) sends information what seems to be a JSON object:
{payload: X, uid: V, src: W, target: U.target}
X = {gadgetName: "PegaGadget", name: "getGadgetInfo"}
V = "HostPage108"
W = "HostPage"
U = {target: "PegaGadgetIfr"}
But there is no return of data or variable.
What am I missing?
I generated the code with pega 7.3 virtual machine from course 'Customizing the User Experience':
<!-- ********************** Begin Pega content ********************** -->
<script src ='https://pegaserver:8443/prweb/PRServlet?pyActivity=pzIncludeMashupScripts'></script>
<div data-pega-gadgetname ='PegaGadget'
data-pega-action ='createNewWork'
data-pega-action-param-classname ='ABB-ReserveIt-Work-Booking'
data-pega-action-param-flowname ='pyStartCase'
data-pega-action-param-model =''
data-pega-isdeferloaded ='false'
data-pega-applicationname ='ReserveIt'
data-pega-threadname ='STANDARD'
data-pega-systemid ='pega'
data-pega-resizetype ='stretch'
data-pega-url ='https://pegaserver:8443/prweb/PRServlet'
data-pega-redirectguests ='true' ></div>
<!-- ********************** End Pega content ********************** -->
Thank you!
PS. Using HTTPS or HTTP (with respective port) doesn't make any difference.