Your button click requires that this take place as a script.
In order to have this happen without a script (if it is even possible to do so), would require that you not click a button to make this happen.
You could, for example, click a single value check box to enter a value into the field and then combination of calculations and relationships that refer to the value in this checkbox formatted field might produce the result that you want.
But you'll need to describe the exact relationship, exactly what data you want copied to the related table and why before I can tell if it is even possible to do this without a script.
I am probably doing this wrong so I will discribe what i am trying to do
I have a portal (a) from a related table on my layout contianing a range of products.
I want to be able to just click on any of these products in portal (a), create a new record in table (b) and add the products ID
Yes, that can be done, but not as just a calculation. It would need a script--which you say you already know how to do?
HELP ..... Forget about me saying I could script it!!!
The script i built on an earlier application using a button on a portal populates a named field on layout. I need to be able to add a record and populate a table field :(
I will assume these tables and relationships for my answer. You'll need to adjust your implementation of this solution to fit your actual tables, relationships and fields:
Invoices::__pkInvoiceID = LineItems::_fkInvoiceID
Products::__pkProductID = LineItems::_fkProductID
Invoices::anyField x ProductsToPick::anyField (with the x operator specified, it doesn't matter what fields are selected as match fields.)
For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained
Your Layout is based on Invoices and you have a portal to ProductsToPick and a Portal to LineItems. A button located in the portal row of the portal to ProductsToPick will use the following script to create a new record in LineItems that is correctly linked to the current Invoices record and to a Record in Products. Note that ProductsToPick and Products, most cases, will be two Tutorial: What are Table Occurrences? of the same table and that is what my code assumes.
Set Variable [$InvoiceID ; value: Invoices::__pkInvoiceID ]
Set Variable [$ProductID ; Value: ProductsToPick::__pkProductID ]
Go to Layout ["LineItems" (LineItems) ]
Set Field [LineItems::_fkProductID ; $ProductID ]
Set Field [LineItems::_fkInvoiceID ; $InvoiceID ]
Go to Layout [Original Layout]
That looks the buisness :) your a star