AnsweredAssumed Answered

Better MouseTrap: Copying Records without Triggering Layout Enter?

Question asked by user26705 on Oct 15, 2016
Latest reply on Oct 15, 2016 by user17152

I am using a script that is trigged when you "enter" the layout.


The script determines if there are any records for a given project and if no records exist for that project, the user is then asked if they would like to import the records (about 150 records) for the project they are working on.


If they user selects to import the records to the project, the script will Freeze the Windows, switch to another layout and grab the first of the 150 records that need to be imported.  A loop is entered, variables set, and then the script switches back to the "original" layout in order to add the imported record to the project table.  This where the problem lies -when the layout switches back it triggers another "layout enter" event and the script starts all over again.


Is there a way I can do this without triggering the repeated instances of layout enter?  The current workflow is highly desired in that a user can open the layout and import the records all in one step - which minimizes issues and simplifies interaction.


I have attached screen shot of my current script. Line 17 is where the script attempts to reset the context and where the new "on enter" trigger is unfortunately fired.


Truly appreciate any guidance as I am new to scripting and have tried various approaches but they all seem to lead to a wall.


Thanks in advance!