1 Reply Latest reply on Oct 25, 2013 9:11 AM by philmodjunk

    New record via Drop Down

    JeraldAbille

      Title

      New record via Drop Down

      Post

           I have a drop down button that has a value list from another table. What I want to happen is if the user types a value in that drop down button that does not exist in the table from its value list, I want that new value to be created as a new record on the related table used on the drop down.

        • 1. Re: New record via Drop Down
          philmodjunk

               IF you have this relationship:

               LayoutTable::dropDownListfield = anotherTable::Value

               Then the onObjectSave trigger could be set on the drop down list field to perform this script:

               If [ IsEmpty ( anotherTable::Value ) // no matching record in related table]
                  Set Variable [$Value ; value: LayoutTable::DropDownListField ]
                  Freeze Window
                  Go To Layout ["anotherTable" (anotherTable)]
                  New Record/Request
                  Set Field [anotherTable::Value ; $Value ]
                  Go To Layout [Original Layout]
               End If

               Note: scripts that change layouts can trip a large number of script triggers that might be set on either layout. Scripts then performed by those triggers can interfere with the correct execution of the script that tripped them.