September 9, 20169 yr This may seem like a strange request, but I am wanting to know if anyone has a handy way of being able to tell when a layout was last used? I ask this as I would like to delete some layouts that are no longer used but i don't want to do this if my users still need them, there have been a lot of requests for layouts showing information that I am sure are no longer needed / or haven't been used for a while.
September 9, 20169 yr Author I have previously attempted something like that but I get caught in an infinite loop. On Layout Enter Set Variable [$LayoutName; Value: Get (LayoutName) Go to Layout["LayoutUseage" (LayoutUseage)] New Record/Request Set Field [LayoutUseage::Layoutname;$LayoutName] Close Window [Current Window] Go to Layout [original layout] The problem with this is, the instant I go back to the original layout the Layout Enter script fires again and I'm caught in a loop.
September 9, 20169 yr You need a way to turn off the trigger after it's fired. If the first step in your OnLayoutEnter script trigger is this: Freeze Window If [$$Triggers]//this should be populated on first window open with a value of 1 Set Variable....//layout name Set Variable[$$Triggers; ""] //turn trigger off so the script wont fire again with new window New window... Go to layout... New Record Request... Set Field.... Commit Records... Close Window Set Variable[$$Triggers; 1]// turn triggers back on End If If you go to the layout, the script runs. It will grab the layout and set a variable. When the new window pops up, at that point the trigger will fire, but because it's turned off it wont do anything. The script will continue, the trigger will be reset, the window will close and the user will never know Edited September 9, 20169 yr by Steve Martino
September 9, 20169 yr 24 minutes ago, lucyblade said: The problem with this is, the instant I go back to the original layout the Layout Enter script fires again and I'm caught in a loop. Instead of fighting with this, why don't you sidestep the problem by triggering the script OnLayoutExit? Then your script could be simply: Set Variable [ $layoutName; Value:Get (LayoutName) ] Go to Layout [ “LayoutUseage” (LayoutUseage) ] New Record/Request Set Field [ LayoutUseage::Layoutname; $layoutName ] Exit Script [ Result: True ] Another option would be to write the log into a global field/variable, and transfer the data as part of your closing script.
Create an account or sign in to comment