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

In Pega Mashup, gadget is not loading as expected for first time

SA-42153

Summary



User has configured two gadgets, one to display work items and the other to create work action. When user is accessing the mashup page in an external application, one of the gadgets is loading as expected. Status fail message is thrown for the other gadget.

Error Messages



status fail message:


Steps to Reproduce



1. Configure Pega Mashup with two gadgets with data-pega-action-param-parameters configured as authentication parameters.

For instance
,

<div id="PegaGadgetA" style="display:none;" data-pega-gadgetname ='PWGadgetA'
data-pega-action ='createNewWork'
data-pega-action-param-classname ='OES1W1-myApp123-Work-CSR'
data-pega-action-param-flowname ='pyStartCase'
data-pega-action-param-model =''
data-pega-isdeferloaded ='false'
data-pega-applicationname ='MyApp123'
data-pega-threadname ='STANDARD'
data-pega-systemid ='pega'
data-pega-resizetype ='stretch'
data-pega-url ='http://hostname:8282/prweb/PRServlet'
data-pega-action-param-parameters={UserIdentifier:"Admin@myapp123",Password:"cnVsZXM%3D"}> </div>



<div id="PegaGadgetB"
style="overflow:auto"
data-pega-gadgetname="PWGadgetB"
data-pega-action ='display'
data-pega-action-param-classname ='OES1W1-myApp123-Work-CSR'
data-pega-action-param-harnessname ='MashUpHarness'
data-pega-action-param-model =''
data-pega-isdeferloaded ='false'
data-pega-applicationname ='MyApp123'
data-pega-threadname ='STANDARD'
data-pega-systemid ='pega'
data-pega-resizetype ='stretch'
data-pega-url ='http://hostname:8282/prweb/PRServlet'
data-pega-action-param-parameters={UserIdentifier:"Admin@myapp123",Password:"cnVsZXM%3D"}>
</div>


Root Cause



Reported behavior is because of the race condition between two network calls.

Two requests are called in parallel with pre authentication cookie. Server will start executing the first request and requestor will be authenticated. Server will start executing second request and it sees request has pre-authentication cookie even after user is authenticated in the first request and it throws an error.

Resolution



Perform the below steps as local-change:
  1. Defer load one gadget by adding "data-pega-isdeferloaded ='true'" attribute.
  2. Add onload event for the other gadget by adding "data-pega-event-onload = 'gadgetLoadCallback'" attribute.
  3. Add script to load deferloaded gadget once the other gadget is loaded as below:

function gadgetLoadCallback() {
pega.web.api.doAction("<Second Gadget Name>", "load");
}



Published August 9, 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