8 Replies Latest reply on Dec 7, 2016 7:00 AM by globe11123

    Passing Information through a layout.


      I'm very new to FileMaker so I have been getting stuck for hours upon end doing something that is probably quite simple.

      Basically in our company we start off by creating an account for a company, this will include all relevant information such as Company Name, Billing Addresses, Phone Numbers etc all the general shebang. Next we assign contacts to these accounts ( via company name ) and an account will have many contacts.


      I have setup the layouts for Accounts and Contacts and the Tables. The relation between them is one to many, the Account_ID being a foreign key in the Contacts table which allows an account to have many contacts related to it. ( Correct me if I'm wrong )


      I want to be able to on the Accounts page to create a contact which will be triggered by a script on a button that passes over the Accounts::Company to Contacts::Company.


      I have tried creating a script and using the Set Field function but nothing passed over.




      When creating a new contact you have the Company field blank but a popover button allows you to pick a Company from the list of Company's related to the Accounts table.


      Any help or guidance would be much appreciated!

        • 1. Re: Passing Information through a layout.

          I believe you may be able to accomplish this via a portal in your Accounts layout. All you would need is to create the portal to Contacts and under the Relationships graph, turn on "Allow Creation of records in this table via this relationship" for Contacts. This will automatically pass over the AccountsKey and create the contact based on information input by the user.




          • 2. Re: Passing Information through a layout.

            I already have this but it would be nicer to have a small interface to type the contact details but ive tried this through a popover button but it didn't work.

            • 3. Re: Passing Information through a layout.

              Often times I use a Settings table to store temporary data prior to creating a new record. The settings table contains all global fields and only one record. Using this table you could create the popover you want and pass the information from Accounts to Contacts.


              Something like this:


              Set variable $AccountID = Accounts::Key

              Go to Layout Contacts

              New Record/Request

              Set Field Contacts::AccountKey = $AccountID

              Set Field Contacts::Name = Settings::ContactName



              I use a variable for the Accounts key since you don't want the user to retype the key into a Settings field in the popover.


              Also, be sure to clear the global fields at the end of the script since they will retain all data entered:

              Set Field Settings::ContactName = ""



              Hopefully this helps,


              • 4. Re: Passing Information through a layout.

                That would be helpful, Couldn't you just pass Accounts::Account_ID and Accounts::Company straight to Contacts Layout? As these are the only 2 fields im interested in.


                Then they can manually type in contact details without a popover in the contacts layout.

                • 5. Re: Passing Information through a layout.

                  You could via the use of variables like so:


                  Set Variable $AccountID = Accounts::Account_ID

                  Set Variable $Company = Accounts::Company

                  Go to Layout Contacts

                  New Record/Request

                  Set Field Contacts::Account_ID = $AccountID

                  Set Field Contacts::Company = $Company


                  Since you are switching from Account to Contacts you lose the context to determine which Account_ID or Company data to grab from Account, hence the need for variables.


                  This is my understanding at least, someone may have information to the contrary.




                  • 6. Re: Passing Information through a layout.

                    Thanks, I've only passed Account_ID now.

                    Changed the company name to a calculation field which looks at the related account company name field.

                    • 7. Re: Passing Information through a layout.

                      a) you shouldn't need a field in Contacts for the company name--neither a calculation field nor a text field is really needed as you can refer to the related table where you have the company name.


                      b) you might want to do a web search for "MagicKey" as a way to create these related records. It avoids changing layouts and/or creating a new window and this can be advantageous.

                      1 of 1 people found this helpful
                      • 8. Re: Passing Information through a layout.

                        I ended up using MagicKey's on this occasion.


                        Funny to think this time last year I picked up filemaker for the first time