Grrr, a glitch in the web browser (not this forum's software) keeps taking me back one page and loses my input. 3rd try here....
There are ways to use go to object and go to portal row to create the illusion that the popover has stayed open and that scrolls the current portal row back into view, though not back to the exact original position.
but you can create records in a related table without changing layouts. This will leave the popover open and the portal scroll position unchanged.
I am assuming from your script that Artwork_PriceList_Popover is the basis for your current layout. In your Relationships Graph, add a new occurrence of the line items table named Price List LineItems|AddNew.
Create this relationship with "allow creation of records..." enabled for the new table occurrence:
Artwork_PriceList_Popover::gAddNew = Price List LineItems|AddNew::__pkPriceListLineItemsID
gAddNew should be a field with global storage. Global storage allows multiple users to use this relationship to create new records at the same time. If you have a field in the line items table that auto-enters a serial number, use it where I have specified the __pk field in the above relationship. If you do not, add one to that table to use here.
The script to add new records will work like this:
Set Field [Price List LineItems|AddNew::_fkArtworkId ; Artwork_PriceList_Popover::__pkArtworkID ]
Set Field [Price List LineItems|AddNew::_fkPriceListID ; Price List::__pkPriceListID ]
Set Field [Artwork_PriceList_Popover::gAddNew ; "" ]
How it works:
The global gAddNew field must be empty at the time the first Set Field step shown here executes. The "allow creation..." relationship option enables FileMaker to create a new record in the price list field and then copy the ID from the new record into the gAddNew field. Until you clear gAddNew, the above relationship now links to this newly created record and any additional set field steps that assign data to fields from the "add new" occurrence will update fields in this newly created record. Until records are committed, a revert record, either done manually or via a script will undo the creation of this new record. Clearing the gAddNew field resets things so that the next time the first set field step executes, another new record will be created. Until records are committed, all such newly created records in the related table will disappear if a Revert Record takes place and this is something that you can exploit with a "cancel" button that undoes all the input in multiple related records all in one "go".
Thanks so much Phil, attached is my current relationship graph (before the above changes you suggest). Does what you suggest still apply?
The layout I am in with the popover issue I want to address is "Price List" but the popover portal in that layout is called "Artwork_Pricelist_Popover"..
Then you would link the new table occurrence to Price List instead. That should be the only change needed if your original script was working correctly except for the popover/portal display issues that you described.
Thank you, that worked, I just needed to add a commit records step to make the records appear in the other portal (price list line items) as they were clicked.. I'm going to try and apply the same logic to my sales report section.. stay tuned..