Forum Discussion
You can try and interact/play with the browser history using window.history.pushState but in my experience it's a little inconsistent and if a user keeps clicking back then they still might get back. My suggestion would be to actually modify the code page and before you do anything check to see if that record has already been processed like checking a box for 'copied' on the original record. Another option is to provide a submission screen where they user can cancel out to cancel (like a confirm/submit & cancel buttons page instead of having the code page automatically process).
\In the first example where you check to see if you should copy - you can instead just redirect them to the home page since they've already processed that entry.
------------------------------
Chayce Duncan
------------------------------
- NathanMaubert2 years agoQrew Trainee
Unfortunately the record is a template project and could be copied several times over. I am wondering if I can open the code page in a pop-up and on completion close and then refresh the original page or redirect it to the edit record form. Just not sure how or if that would work.
------------------------------
Nathan Maubert
------------------------------- ChayceDuncan2 years agoQrew Captain
You could do a pop up using the following syntax:
"<a class='Vibrant Success OpenAsPopup' data-height=350 data-width=500 data-refresh=true href=\""& url here &"\" >Copy</a>"
That will open up your code page and when the user clicks to close it, either with button or just closing the window QB will refresh the current page.
You could still go with a confirmation process in the code page that says 'confirm copy' or cancel so that the copy is not immediate if they land back there mistakenly.
------------------------------
Chayce Duncan
------------------------------- NathanMaubert2 years agoQrew Trainee
So if I am understanding you adding a confirm would be on load. however I do not want the user redirected back to the page each time only to have to click a cancel button as this certainly would be confusing. Managed to open the code page as a pop-up and refresh the original report. Might be good enough for now but can't embed this button on any forms as it does redirect incorrectly there (causes a second copy).
------------------------------
Nathan Maubert
------------------------------