Let's see if I can help. First create a button, after which you can add a script, the 2 lines you need are "Go to Layout [layoutname]" followed by "New Record/Request". This will switch you to the WO layout, and call for a new record to be made.
Yes, but the new work order record should be automatically linked by ID to the current record in Main
Set Variable[$ID ; Main::ID]
Go To Layout [Work Order]
Set Field [WorkOrder::ID ; $ID]
Awesome! Thanks for the help!
Okay, but what if you want the script to also automatically fill in some fields from related records? For instance, what if you want the name of the customer and their company to get filled in to those fields so that other fields can then get calculated based on this unique set of values? I have been trying to get the script to do this by looking up the value from the other table and by getting values but nothing I try works.
If I understand your question Cora, as an example, you have the company info in a contacts table. When you use Phil's script, you'll end up on the new layout with the new record. If on that new layout you put fields or merge fields from the contacts table (company name, address, etc) they will show up. You can see this in the starter solutions.
I see now that this is supposed to happen, but for some reason, I can't get it to happen. I have tried so many things and I think there must be something wrong with my code or my relationship. It seems like my relationship should be okay, though, because other related table steps are working fine.
Here is my script, based on the above recommendation:
Set Variable[$Vessel_Lot_# ; Ceramic_Extended_Database::Vessel_Lot_#]
Go To Layout [Vessel_Lot]
Set Field [Vessel_Database::Vessel_Lot_# ; $Vessel_Lot_#]