3 Replies Latest reply on Apr 26, 2016 8:12 PM by dsvail

    Need a little help here please

    user26927

      I am new to filemaker.

       

      I have a portal showing all records (accounts) inside a related table (contacts).  I want to be able to click on one of the accounts to link it to the contact.  I have an empty field (account ID) in the contact layout where the portal showing all accounts is.

       

      The portal is in a popover.  How do I script it so the user can click on the appropriate account record (from the portal, in the popover) and populate the empty related account ID field?

       

       

      Thank you very much for the help!

        • 1. Re: Need a little help here please
          erolst

          Add a button to the portal row (or define one of the existing fields in the portal row a button) and let it perform this script step:

           

          Set Field [ target field: Contact::accountID ; calculated result: Account::ID ]

           

          where in Account::ID Account is the Account table occurrence of the selection portal, and ID is the name of the Account table's primary key.

          • 2. Re: Need a little help here please
            user26927

            Hi erolst- thanks for the suggestion.

             

            I tried what you recommended....but I ran into a few issues....the button didn't do anything.

             

            Maybe I should back up one step to make sure the relationships are correct.

             

            I am in the contacts layout...based on the contacts table.

            I want to make sure all contacts are related to an account. For example:

            Account: Apple Computers

            Contact: Tim Cook

            Conact 2: Jony Ive

             

            We are going to a trade show this weekend and we plan on using this database to capture new leads.

            I am certain someone will create a contact without having the time to create the account and relate the contact to the correct account record (if one already exists).

            I plan on going back later and relating the contacts to the correct account.

             

            I want to display a portal (on the contact layout) showing all accounts.  From this portal (list of all accounts) we will select the correct account the contact belongs to.  If necessary....we will create a new account...(hopefully from a button in the popover where the portal is displayed).

             

            I created a new TO....related to the contacts table to show all accounts called "all accounts popover" with AccountID from the contacts table as the fk and AccountID from the new TO...based on accounts with AccountID as the pk.

            Attracted is screenshot.

             

            Screen Shot 2016-04-26 at 9.25.27 PM.png

            • 3. Re: Need a little help here please
              dsvail

              script should work unless your context is incorrect.   correct context of the account is from the popup ... the TO ...All Accounts Popover

               

              script step is .......

               

              Set Field [ target field: Contact::_AccountIDfk ; calculated result: All Accounts Popover::__AccountIDpk]