2 Replies Latest reply on Jul 14, 2010 7:07 PM by LaRetta_1

    search and create new record

    lkmcclendon

      Title

      search and create new record

      Post

      Newbie, using v10, I have a table with donations, and I have a table for members.  I have a relationship with the member id field.  I am trying to use a donation layout for the members.  There can be more than one record for donation for the members.  I am trying to create a script, from a menu to go to the donation layout and find a member with their name on this layout and enter a new record of donation.  Right now I get to the layout, and I can find the name for the records already in the donation, but it dosen't create a new record or does it find members with no donation record to populate it.  The Script goes to find mode, perform find and enter browse mode.

        • 1. Re: search and create new record
          philmodjunk

          The simplest approach would be to place a portal to donations on your members layout. If the relationship has "allow creation of records via this relationship" enabled for donations, adding a new donation record is a simple as entering data into the bottom row of this portal.

          • 2. Re: search and create new record
            LaRetta_1

            I would suggest that you control new record creation (remove that option using custom menu and restrict privileges in your Security Settings).  Then you create a value list of all customers (based upon values from field of CustomerID and all values).  Also display their name as second field.

            Add a global text field in any table and place it whereever you want Users to select the customer name.  Attach your value list to this global text and specify Pop-up Menu (important it is pop-up and not drop-down).  I don't know your version so I'll keep this generic and you can use variables, script triggers etc. to enhance the experience.  Selection from pop-up will insert the selected CustomerID into the global field.

            Place button next to global field to run the 'new record'.  Script might be:

            If [ IsEmpty ( global ) ]

            Show Custom Dialog [ "No customer selected.  Try again." ]

            Halt Script

            End If

            Go To Layout [ "Donations Detail" ; based upon Donations table occurrence ]

            New Record/Request

            Set Field [ Donations::CustomerID ; global ]

            Go To Field [ whatever ... to begin completing the transaction for that customer ]

            ---------------

            • Now, if you are on a customer layout looking at the customer you want, just attach a script parameter to a 'New Transaction' button.  Change the above line in blue to:  Set Field [ Donations::CustomerID ; Get ( ScriptParameter ) ] and just skip the portion in grey completely.
            • Or you can just use script variable to capture the current customer's ID.  Replace the grey with: Set Variable [ $custID ; Customers::CustomerID ] and then change the Set Field [] to: Set Field [ Donations::CustomerID ; $custID ]

            There are many variations.  But if you want to be in Donations and let the User select different customers, use global and put the global and button in Transactions.

            ---------------

            If you do not wish to have such tight control, just let the User create a new Transaction record via menu or shortcut.  Then when they select the Customer, attach that pop-up with the value list directly to the customerID field in Transactions.