8 Replies Latest reply on Jun 3, 2012 8:10 PM by philmodjunk

    Field Content Script Trigger

    Willz

      Title

      Field Content Script Trigger

      Post

      Is ther a forumul to  trigger a script when specific text content is entered into a field.

      Example:  When the words "New Product" is entered into a field it will trigger a script to occur.

        • 1. Re: Field Content Script Trigger
          philmodjunk

          You have to go with a trigger that fires every time and then use an IF step to test for the specific value:

          Example: OnObjectSave will fire when you exit the field after entering a different value in that field. The script might be:

          If [YourTable::YourField = "New Product"]
             #Do the things you need when this value is entered into the field
          Else
              #Do what needs to be done if a value other than "new product" was entered into your field.
          End IF

          • 2. Re: Field Content Script Trigger
            Willz

            How to when using a dropdown field with value list - when select item in value list - it triggers a script?

            • 3. Re: Field Content Script Trigger
              philmodjunk

              Right Click the field when in layout mode and select "script triggers"

              Select the OnObjectSave trigger and specify that it run this script.

              • 4. Re: Field Content Script Trigger
                Willz

                Yes I have this working as you suggest above but - how do I trigger different scripts depending on the phrase selected from the value list dropdown?  Right now the first item on the value list is correct, but other items in the value list trigger the same scripts no mater which item in the value list is selected.

                Example of value list:

                1. New Product Task List - This tiggers the script I want but that's because it's the field that is set instead of the phrase.

                2. Machine Maintenance Task List - need to trigger a unique script for this.

                3. Product Marketing Task List - need to trigger a unique script for this

                • 5. Re: Field Content Script Trigger
                  Sorbsbuster

                  Modify Phil's suggestion to include your additional criteria, for example:

                  If [YourTable::YourField = "New Product"]
                     #Do the things you need when this value is entered into the field
                  Else If[YourTable::YourField = "Machine Maintenance"]
                     #Do the things you need when this value is entered into the field
                  Else If[YourTable::YourField = "Product Marketing"]
                     #Do the things you need when this value is entered into the field
                  Else
                      #Do what needs to be done if a value other than "any of those" was entered into your field.
                  End IF

                  • 6. Re: Field Content Script Trigger
                    Willz

                    Here is Screencast shot of script suggested above - I have created separate scripts for each item in the drop down value list but it only peforms the same script

                    http://screencast.com/t/8gfyDI2ODb0

                    • 7. Re: Field Content Script Trigger
                      philmodjunk

                      You need one script where each clause of the IF Then Else IF step checks the value in the field and does something different depending on the value. For a drop down, I'd use the OnObjectSave trigger to perform this one script.

                      • 8. Re: Field Content Script Trigger
                        philmodjunk

                        say you have a value list with three values: Apple, Orange and Pear.

                        Your single script would look like this:

                        If [YourTable::DropDownField = "Apple"]
                          #put steps here for what should happen if "Apple" was selected.
                        Else If [YourTable::DropDownField = "Orange" ]
                          #put steps here for what should happen if "orange" was selected.
                        Else If [YourTable::dropDownField = "Pear"]
                           # put steps here for what shold happen if "pear" was selected.
                        Else
                           #put steps here if it's possible for the user to enter a value not on the list.
                        End If