The point of this script is it takes values from a portal located in ShopOrderForm (PurchaseOrders) layout. And shows related records on a layout called RelatedShopItems (Transactions). I then want it to get the names from the layout and mark it out of our inventory through the loop i created. And if there are multiple items then repeat and exit after last
Here's how to use a global variable to keep trigger performed scripts from interfering when you don't want them to:
Enclose each trigger performed script (This is the other script, not the one shown in your post) in an If block like this:
If [ Not $$TriggersOff ]
Put rest of trigger performed script here
Then, in the above script, you need to both turn triggers off and then turn them back on like this:
Set Variable [$$TriggersOff ; Value: True ] ---> you can use the number 1 here and get the same result
Put any steps that might trip a script trigger, such as your Go to Related Records step here
Set Variable [$$TriggersOfff ; Value: False ] ---> you can use zero if you prefer
As long as all trigger performed scripts are enclosed in the specified If block no trigger performed script will be able to interfere with your script between the time you set the variable to True and the time that you set it to False.
Design Notes: You may wonder why I don't set a variable named $$TriggersOn to False to disable trigger performed scripts. I could do that, but it would require me to initialize $$TriggersOn as True when the file is first opened. If [Not $$TriggersOff ] will evaluate as True if no value has yet been assigned to $$TriggersOff, so the method I use avoids that unecessary complication as variables will all start with no values when a file is first opened.
Phil, although it would seem easier to set the variable to TriggersOn and set it to false, your explanation does a very good job at explaining how it would be unnecessary evil. Also just an informative side note... instead of making my If statement like you suggested I made it so:
If [Not $$TriggersOff]
Exit Script [Result: 1]
That also works, but I see no reason to specify a result for Exit Script.