Question
bitsinglass
CA
Last activity: 25 Apr 2017 6:05 EDT
How can add an alert while selecting a specific action from default action drop down in Pega PRPC?
Hi ,
I need to alert the user when selecting 'Cancel' action from the drop down in Pega 7.1.8.I tried to add a java alert but the text file rules which containing JS functions are much complex and not able to customize it.
Is there any other possible methods to do this?
below are the screen shots.
From DEV portal
From end user portal
***Updated by moderator: Lochan to add Categories***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
bitsinglass
CA
Hi all,
I couldn't do it by calling script from harness as the screen will change before calling the script from harness.This is preventing to stop the screen from loading based on alert pop up output.
Finally, i have customized the final rule 'pzActionDropDown' and it worked.
Pegasystems Inc.
US
Denny,
Hi. Are you just trying to have an alert pop up when you load that flow action screen? This isn't really my area of expertise, but assuming no one has a more elegant solution, couldn't you add a small, non-autogenerated section that just contains a <script> tag and an onLoad event which calls the alert? You'll definitely get guardrails warnings, and I suspect there's a better way to do it, but that should work.
- Mike
bitsinglass
CA
Hi,
Thanks for the reply...
How can I get the flow action name in this case ?I need alert only for a specific case like 'Cancel this case'?
I will definitely do a work around on this.
Pegasystems Inc.
IN
we could read the current flow action name from clipboard - 'newassignPage'. please share your thoughts...
bitsinglass
CA
Alerts can be added as onclick /onchange event only right?Whether that will help here..?
Pegasystems Inc.
IN
yes Denny, we could try. onChange configure a local action to be displayed as a modal dialog associated with a when rule (IsCancel).
please note: configuring WHEN rules onClick event would be possible for editable events.
bitsinglass
CA
onchange and onclick ,it is able to run DT and activity with refresh section ...But i will call modal dialog with when condition?
Pegasystems Inc.
IN
bitsinglass
CA
Hi Phani,
Above solution is possible when 'dropdown' control is using.
In my case,'pzActionDropDown' is the control which display flow action names from an assignment which don't have call location action event.
Please find the screen shot in my question.
Pegasystems Inc.
IN
My bad, Apologies Denny. Overlooked at the dropdown control referenced. as Mike said - we may need to write onLoad js event (associated at harness rule under scripts & styles tab). to fire the onLoad event only for a particular flow action, we could read the current flow action name from clipboard - 'newassignPage.pyDefaultTaskStatus'.
bitsinglass
CA
Hi,
I have tried below steps,but simple alert itself not working.
I am not sure about the correctness of this code, but this is very simple one.
1.Created JS text file rule containing below code and added in Scripts and styles tab of harness 'CPMPerform'.
function AlertWhenCancelthisCase(){
Confirm("Are you sure to Cancel this case?");
}
2.Created a non auto-generated section containing below HTML code and added in section 'CPMAction' which containing 'pyActionArea'.
<pega:static type="script" app="webwb" >
<pega:file name="CallAlertPopUpWhileCancel.js"/>
</pega:static>
<HTML>
<body onload="AlertWhenCancelthisCase()">
</body>
</HTML>
Pegasystems Inc.
IN
would it be convincing to perform..
- load cancel UI on screen
- hide default buttons for cancel flow action
- create custom buttons (Submit & Cancel)
- on submit button configure onClick event with modal dialog displaying confirmation message
- perform either submit or cancel the action, post reading the confirmation message on dialog box
please share your thoughts/comments, Thank you
psahukaru
bitsinglass
CA
Hi Phani,
Business not ready to agree the above suggestion and they are particularly need the pop up with 'OK' and 'Cancel' buttons at the moment user select 'Cancel this case' action.
Thanks and Regards,
Denny Varghese
Pegasystems Inc.
IN
could you please try ...
- Window.Confirm("Are you sure to Cancel this case?"); or
- alert("Are you sure to Cancel this case?");
bitsinglass
CA
Hi.
I have tried the above code,and it worked when I am running in DEV portal.But the same not running in end user portal.
Below are the steps I followed.
1.Created a HTML rule which containing JS alert in HTML body.
2.Created an activity where calling HTML using show-stream method.When running this activity standalone, alert pop up is triggering.
3.Added above activity as pre-processing activity in 'refresh section' action of 'pzActionDropDown' control.
4.Activity itself not calling ,when tried to change the drop down values from portal.
The same activity invoked from button ,there it is running but pop up not triggering.
Any comments on this behavior...................
Pegasystems Inc.
IN
could you please verify if there are any warnings/errors noticed in logs to the working and non-working scenario.
also, instead of showing up the pop-up from activity, could you please try associating the script at harness level and share your observations...
Thank you!
Pegasystems Inc.
IN
Accepted Solution
bitsinglass
CA
Hi all,
I couldn't do it by calling script from harness as the screen will change before calling the script from harness.This is preventing to stop the screen from loading based on alert pop up output.
Finally, i have customized the final rule 'pzActionDropDown' and it worked.
Pegasystems Inc.
US
Denny,
I'm glad to hear you found a solution. Though I don't know exactly what you did to customize pzActionDropDown (I assume made a copy with your own name), I'd caution against making that a common practice since you lose the benefit of any enhancements or defect fixes to that rule going forward. And of course if you actually hacked your way into changing the final rule itself, then your version will be called by other rules that directly call the rule so not only might you not get a fix or enhancement, but your code might be incompatible with the new code and actually cause things to fail.
- Mike
bitsinglass
CA
Hi Mike,
That is true.
But I couldn't find any other option other that after tried different methods.
Will keep this mind and try to find a option to replace the customized control with auto generated one.