I have a close tab button and I need to run an activity or data transform when user click on close button. Now there is a requirement that when user click on close the application need to show a confirm message whether user really want to close the tab or not and select "Ok" and "Cancel". I used run script in the action tab as a first action and called that js function where message is displayed. But the problem is the server is not waiting for the return of js function; it just shows the message and automatically close the work object running the subsequent data transform and activity. How will I hold this close action and prevent it from submission onclick of Cancel.
***Updated by moderator: Lochan to update Categories***
I think what i could think of this scenario is, we need to write a custom control for the Close button which will prevent the button from Closing i guess. In Case if the user clicks on Ok we need to handle it in the control to close the dialog and proceed with your actions.
You can call a local action from the closing button with target as a modal dialog and in the section you can configure two buttons 'ok' and 'cancel'. In the Ok button you can call whatever datatransforn/activity you want and as second action you can call 'close' action to close the window.
We have implemented the same functionality in our project.
We need to invoke "launch Local action" on close icon of Work object tab. that displays "Yes" or "No" buttons.
Once user selects "Yes/No" , we will call a data transform to set flag.
and control passes to 2nd,3rd,4th,5th actions of close icon ( these actions exist on OOTB section "CPMPortalRecent".
we need to customize one of activity "CPMClearSIngleRecent" to read above flag. If flag is "Yes" then continue processing to close the work object , If flag is "No" then exit activity to stay on with workobject.
Please find attached document for steps. We don't need custom script.