AnsweredAssumed Answered

"Go to Layout has been canceled." Script Error

Question asked by KenHoopes on Jan 16, 2014
Latest reply on Jan 16, 2014 by philmodjunk


"Go to Layout has been canceled." Script Error


     Please assist,

     I am encountering an error where validation rules on the global fields used for a script attached to a button, do not prevent the script from launching, and allows for erroneous data. My example is below.


     I have two layouts (layouta and Layoutb).

     Layout A has 2 global fields (fielda and fieldb) each with validation rules and one button (buttona)

     Button A has the following script attached:


     Go To Layout["layoutb"(layoutb)]

     New Record/Request

     Set Field [layoutb::fielda; layouta::fielda]

     Set Field [layoutb::fieldb; layouta::fieldb]

     Commit Records/Requests[]

     Go to Layout [original layout]


     As long as the validation rules for the fields on "layouta" are met, the script runs without issue.

     If the validation rules are not met for one of the fields, but the user clicks "buttona" without removing focus from the field first, the validation error pops up with "Revert Field" and "Ok". If the user clicks "Revert Field" the script above continues to run, and duplicates the data in layoutb, which is not a desired result. If the user clicks "Ok" they are presented with a pop up that says "Go to Layout has been canceled. Do you wish to continue with this script?". From there any number of things can happen, but all of them undesirable.


     Is there a way that if field validation is not met, the script will just stop, or even a way that before the button can be clicked no fields can have focus.

     I'm not sure but any advice is appreciated.