Question
Launching Modal Dialog automatically
Hi All,
I am looking to launch a Modal Dialog automatically upon loading a screen (an assignment within a screen flow to be more specific). I have tried a couple of different options:
1. Using a js function with a timeout:
pega.u.d.displaySection('{SectionName}', '{StepPage}',null,false);
This works up to a point, after the section loads in a modal dialog the submit button does not work, the submit button is configured with the control pzModalButton and the submit action, strangely enough if I try changing the boolean parameter to true in the function (which is used to hide OOB buttons) the Submit button with the pzModalButton works, but now I have unwanted additional buttons, I tried to look where these are generated but live ui does not work on them.
2. Using the JS API launchLocalAction
var Event = pega.util.Event;
var options = {
flowAction: "{FAName}",
displayMode: "pega.api.ui.constants.MODAL_DIALOG",
event: "onclick",
flowActionClass: "{FAClass}" ,
contextPage: "{StepPage}",
skinFormat: "",
template: "",
isMobileFullScreen: true,
revealEffectName: "",
closingEffectName: "",
closeOnClickAway: true,
centerOverlay: true,
nodename: ""
};
pega.api.ui.actions.launchLocalAction(options);
But this generates an error in the console
Uncaught TypeError: Cannot read property 'preventDefault' of undefined
at Object.preventDefault (pzpega_ui_harnesscontext_13405383939!pzevalharnessjson_13618607379.js!clientlogbase_11632504602.js!pzpega_ui_lib_provider_1191955478!pega_yui_12813728239!desktopwrapper_12681084965!developerwrapperapi_12187829019.js!pzsyncappexplorer_11452689760.js!pzautomationscripts_1782107713!pzpega_ui_jquery_1876020879!pega_ui_harness_13108332047!pzpega_ui_harness_actions_11967870250!pzpega_ui_messaging_1861668468!pzpega_ui_jstree_1221119030!pzpega_ui_inspector_bundle_1404366545!!.js:9)
at Object.preventDefault (pzpega_ui_harnesscontext_13405383939!pzevalharnessjson_13618607379.js!clientlogbase_11632504602.js!pzpega_ui_lib_provider_1191955478!pega_yui_12813728239!desktopwrapper_12681084965!developerwrapperapi_12187829019.js!pzsyncappexplorer_11452689760.js!pzautomationscripts_1782107713!pzpega_ui_jquery_1876020879!pega_ui_harness_13108332047!pzpega_ui_harness_actions_11967870250!pzpega_ui_messaging_1861668468!pzpega_ui_jstree_1221119030!pzpega_ui_inspector_bundle_1404366545!!.js:9)
at pega.ui.Doc.processAction (pzpega_ui_harness_deferred_before_11691697527!!.js:29)
at p.c.Actions.processAction (pzpega_ui_harnesscontext_13405383939!pzevalharnessjson_13618607379.js!clientlogbase_11632504602.js!pzpega_ui_lib_provider_1191955478!pega_yui_12813728239!desktopwrapper_12681084965!developerwrapperapi_12187829019.js!pzsyncappexplorer_11452689760.js!pzautomationscripts_1782107713!pzpega_ui_jquery_1876020879!pega_ui_harness_13108332047!pzpega_ui_harness_actions_11967870250!pzpega_ui_messaging_1861668468!pzpega_ui_jstree_1221119030!pzpega_ui_inspector_bundle_1404366545!!.js:2712)
at Object.launchLocalAction (pega_ui_harness_deferred_11024540415!!.js:837)
at myFunction (!TABTHREAD7?pyActivity=ReloadHarness&pzFromFrame=pyWorkPage&pzPrimaryPageName=pyWorkPage&pzTransactionId=3375ad08fe98577757bf710b6945fc23&pzHarnessID=HIDD5BD74FA17FDDC332EB5573BE00B8E3B&PagesToRemove=&PreActivity=RefreshOnConflicts&ActDTPage=pyWorkPage&HarnessMode=ACTION:119)
at HTMLAnchorElement.onclick (!TABTHREAD7?pyActivity=ReloadHarness&pzFromFrame=pyWorkPage&pzPrimaryPageName=pyWorkPage&pzTransactionId=3375ad08fe98577757bf710b6945fc23&pzHarnessID=HIDD5BD74FA17FDDC332EB5573BE00B8E3B&PagesToRemove=&PreActivity=RefreshOnConflicts&ActDTPage=pyWorkPage&HarnessMode=ACTION:73)
The error changes if I change the value of the event parameter, maybe that is what I'm missing, considering that I want to load it automatically, not sure what value to pass.
Can anyone please provide input on how to achieve this requirement? Any input is greatly appreciated
Hi
Please refer the below link for help
https://community1.pega.com/community/product-support/question/auto-launch-modal-popup-upon-screen-load
Thanks,
Smruthi P V