2 Replies Latest reply on May 20, 2014 10:45 AM by Vicky

    Scripting help

    Vicky

      Title

      Scripting help

      Post

           Hi,

           I have a drop down list for the field Qb with a custom value list that only has the word "yes".  My boss wants the field Qb to become empty  for the current record every time he modifies the record.  I tried writing a script to set the Qb field to blank and then used it on the script trigger onRecordCommit.  But of course that means that every time we try to modify the Qb field, it will just go back to being empty.  I am not very experienced in scripting.  Is there anyway to make it so Qb won't become empty when we try to modify Qb but will go back to blank if we try to modify the other fields on the layout?

            

           Thanks,

           Vicky

        • 1. Re: Scripting help
          philmodjunk

               A drop down list with only one value seems very unusual. I'd probably set up that field with a check box format instead so that I can just click the field to clear or set the field to yes.

               You can write your OnRecordCommit script like this:

               If [ Not $$TriggersOff ]
                  Set field [ Yourtable::Qb ; "" ]
               End If

               Then the OnObjectModifyTrigger on your QB field might perform this script:

               Set Variable [$$TriggersOff ; value: True ]
               Commit Records
               Set Variable [$$TriggersOff ; value: False ]

               If you "wrap" all trigger performed scripts in this type of IF block, all referencing the same global variable ($$TriggersOff), you can set this variable to True in any script where you need to be sure not to trip any other script triggers so long as you set it back to False before the script exits.

          • 2. Re: Scripting help
            Vicky

                 Thank you Phil!

                 It worked like a charm.