Removing from a portal
I have a script that is supposed to remove artworks from a portal. I use portals for making invoices and consignment forms and my script is similar for both.
When the script runs it just removes the most recently added artwork to the portal rather than the one on the selected line. For example, clicking the remove button on the bottom artwork here (Matthew Deleget), will remove the top artwork (Cordy Ryman).
I'll include my script below and my relationship graph, any ideas would be fantastic.