Support Article
Unable to pass values dynamically to mashup code
SA-67620
Summary
A Pega Web Mashup code is generated from the case type.
Values are passed using JavaScript variables in the Mashup DIV data attributes to send additional arguments dynamically,
data-pega-action-param-parameters ='{"Arg1":arg1Value,"Arg2":arg2Value}'
However, the application login page displays instead of Pega Gadget.
Error Messages
Not Applicable
Steps to Reproduce
- Generate the Mashup code from the case type.
- Add the line of text, 'data-pega-action-param-parameters ...', to the Mashup code with custom arguments.
- Run the Mashup HTML code.
ROOT CAUSE
A software use or operation error.
The issue occurred because the data-pega-action-param-parameters where custom parameters are provided is an HTML5 data attribute which does not support templating. Variable expansion is not supported out-of-the-box.
Resolution
Perform the following local-change:
Use the JavaScript code or any other Web Template System to insert dynamic elements to the data-pega-action-param-parameters Pega Web Mashup attribute.
Use the following JavaScript code can be used for this purpose:
<script src ='http://desktop:7731/prweb?pyActivity=pzIncludeMashupScripts'></script>
<body>
<!-- ---------------------- Begin Pega content ---------------------- -->
<div id="PegaGadget#1"
data-pega-gadgetname ='PegaGadget'
data-pega-action ='createNewWork'
data-pega-action-param-classname ='PegaCA-Work-AddressChange'
data-pega-action-param-flowname ='pyStartCase'
data-pega-action-param-model =''
data-pega-isdeferloaded ='false'
data-pega-applicationname ='PegaCSSample'
data-pega-threadname ='STANDARD'
data-pega-systemid ='pega'
data-pega-resizetype ='stretch'
data-pega-url ='http://desktop:7731/prweb'
data-pega-redirectguests ='true' ></div>
<!-- ---------------------- End Pega content ---------------------- -->
</body>
<script>
var action_param = "{UserIdentifier:'CACSR',Password:'cnVsZXM=',ctn:'123',channellId:'456'}";
var gadget = document.getElementById("PegaGadget#1")
gadget.setAttribute("data-pega-action-param-parameters", action_param);
</script>
Add the JavaScript code, that assigns the data-pega-action-param-parameters value, after the corresponding DIV element.
Published August 19, 2019 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.