Question

5
Replies
781
Views
Joaquin Cabrera Garcia (JoaquinC)
Ruletek LLC

Ruletek LLC
US
JoaquinC Member since 2017 2 posts
Ruletek LLC
Posted: October 23, 2017
Last activity: March 23, 2018
Posted: 23 Oct 2017 17:07 EDT
Last activity: 23 Mar 2018 7:24 EDT
Closed

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&gt;
<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.

Data Integration
Moderation Team has archived post, This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.