AnsweredAssumed Answered

Have onExit script cancel the user entered action?

Question asked by LeeMoreau on Aug 19, 2015
Latest reply on Aug 19, 2015 by philmodjunk

Title

Have onExit script cancel the user entered action?

Post

Hi everyone, maybe I'm not doing this the best way but here's my issue.  If a user is on a table and clicks a button to create a related record, my scripts do the relationship and go to the create record page for table B.  Sometimes users click it by mistake and then want to go back, which results in basically an empty record in table B.  So I'm trying to use a dialog box so that if a user leaves the table B layout and has any of 5 fields empty, it pops up asking if they want to cancel and stay on the page, or force save.  I have this working using IsEmpty scripts and the pop up appears as expected.  The problem I have is the default button is cancel, so I've used If Get(LastMessageChoice) = 1, Exit Script.  When the script ends though, it goes on to whatever it was I clicked before.  So if I was on a new record for table B and clicked in the layout dropdown to go to layout G, when I hit cancel on the pop up it just continues on to layout G.  How can I make it so that it cancels out whatever it was the user did or clicked on and stays on this page so they can fix their errors?

 

Outcomes