1 of 1 people found this helpful
I've encountered something similar. Use a global variable to temporarily disable the script from running when you switch layouts. The variable needs to be global so that the next time the script runs, that instance of the script can see the variable.
At the very beginning of your script, use an IF statement to exit the script if $$skip = 1.
Inside your IF Get ( LastMessageChoice ), set the variable $$skip to 1. And the end of this IF statement, once all of the actions are complete, set $$skip = "", thus destroying it.
The first time the script runs, $$skip does not exist, so the script will proceed as normal. Once the user says "yes" to importing, $$skip is set to 1. As soon as the layout enter script trigger runs, it will exit because $$skip = 1. Before your script ends, clearing $$skip makes sure there's no $$skip variable when the user moves on to the next record.
There might be other ways to do this, but this is how I've handled something similar.