Popover for contact data entry against related field
I've got a couple of choices of methodd to add contacts to customers, I can use a portal which works very well but looks a little ugly, or I'd rather use a popover.
The latter, I've got a script which passes the entered details to global fields and from there, to the related contacts table. This is working fine.
The problem which crops up is that when I enter a new contact via the popover method, it's creating a new blank record based on the parent (customer) layout, which clearly I don't want. This is some cases has the same ID as an existing customer which is nuts. My customer table is auto number and serial and the relationship between that and contacts is such that no records should be created there.
When I use the portal method, based on this existing relationship, everything works as I want it - but it's ugly!
Here's the script I'm working with at the moment attached, hope you can read it as I cannot copy/paste from FM for some reason.
The Clean up Contact Popover script just blanks out the global fields in the popover for use next time.
Edit: I've taken a second look at this and believe the New Record/Request step is creating the new parent records. If I take this out, that's one problem solved. However, the next issue is that the last entered contact record already exists in the new popup and simply gets over written by new data.
Any help appreciated, thanks