I am using FM Pro 12 and I want to avoid using Portals.
Not using portals in FileMaker is like rowing a boat with only one oar--not likely to work well for you.
Nevertheless, even with portals, it is often necessary to use a script to create a record in a table other than the table referred to by the current layout.
The basic script is quite simple:
Go to Layout [specify the layout]
That satisfies the request that you posted. It navigates to a different layout and then creates a new record in that layout's table.
But I suspect you need to see more than this happen. Often data, such as a primary key, needs to be copied from the current record of the current layout to the foreignkey field of the new record in the other table:
Set Variable [$ID ; value: YourTable::PrimaryKey]
Go to layout [Layout for Your Table 2]
Set Field [YourTable 2::ForeignKey ; $ID]
Note that any number of values can be loaded into variables and then transferred to the new record should that be necessary.
PS. This post doesn't have anything to do with FM Server even though it was posted to the FM Server section. (See tabs at top of screen). Had it been posted to the FM Pro Forum section, it likely would have gotten a response the same day that it was posted.
Thank you for the explanation . It worked! Apologies for not writing this topic in the correct section. I thought it was in FM Pro section.