You might wish to post screen shots of your Relationship Graph (just the 3 tables noted) and screen shots of your layout (layout mode) where these portals are located.
Having a better idea of your set up would be helpful. So that stated, in similar setups I like to use the "magic key" method. Take a look at this link: https://filemakerhacks.com/2011/07/31/magic-key-and-check-box-reporting/
What I do is set up a Global field in the layout base table and connect it to a Table occurrence for the child table where you want the new record. Make sure you check "allow records to be created in this table via this relationship" is checked.
Have a script attached to a button that does the following:
Gets the ID of the parent record + any other information
Set field [new global field; "" ) // clears the new global field
Set Field [ NewTableOccuence::ForeignKeyField ; Primary key for parent record ]
Additional set field steps here if required
Your new record should be there and connected correctly.
I prefer magicKey myself, but just to document some interesting behavior in FileMaker, note the following:
If you have this relationship: (---< means "one to many" )
and you enable "allow creation" for Child in the first relationship and GrandChild in the Second.....
You can put a portal to GrandChild on the Parent layout and if you then enter data into the "add row" of this portal, FileMaker will create TWO new records, one in Child, one in GrandChild and they will be linked with appropriate values to link parent to new child to new grand child.
There are severe limits here to this being useful, however, as each new record in the GrandChild record creates a new Child record, you can't keep adding additional GrandChildren to a given Child record via this method.
Hi Phil, this is the behavior I've encountered. I can't seem to create records up to the 3rd level of the relationship when working on the parent table. Does this mean that I need to navigate to Child table first and put a portal showing records from the Grand Child?
As I said, I prefer magicKey. That method uses neither portals, new windows, nor does it change layouts to do so.
Phil, I also love Magic Key, for the reasons you mention, but have found it to be really slow when you need to create many records. Have you any tricks you use to enhance performance?
For cases where performance becomes an issue, I change methods. There's nothing inherently wrong with opening a window and changing layouts to a layout based on the related child table in order to create child records, you just have to watch out for a few script trigger's that might be tripped (and in 16 that issue is much reduced) as well as being sure that the window is truly hidden.
Maybe I could use the new card window style for this...
I have found that putting Magic key in a loop is very quick. I frequently use auto-enter formulas with Do Not Replace checked, that get their value using a variable. So if done for all fields, the loop would be something like
Exit loop if....
Set Variable ( single step using Let to set variables for all fields )
set field [global field for new record ; "" ]
set field [ new record table occurrence foreign key ; parent record ID
So my experience with this is more work on set up/ field formulas. Much faster then new window and script for new records...