I have an odd issue with a script that is essentially the exact same as another script that functions perfectly.
Script 1 inserts a document, script 2 does exactly the same but is sets a field to a value that indicates the "document" is an INVOICE
On the layout I have one filtered portal to display all documents associated with the parent record. This is to separate documents that are created in different modules. All documents are created as records in one table.
Just a reminder that Script 1 works flawlessly. I have attached screenshots of each script, and also a shot of the filter for the "INVOICE" portal. I have tried all sorts of variations to see if I can get this to function and it is not behaving. Script 2, sets all the required fields as it should perfectly. The issue is that script 2 will replace the document in a previous record instead of inserting the new document in the last record created.