Portals:Issue with creating new record with a script
I've written a button script (attached) to create a new record in a portal. The problem is that the script goes to the last portal row but does not create the new record.
Image of portal
which means that it's doing exactly what you set it up to do, just not what you want it to do. A new record will not be created until you enter data into a field of that "add" row in your portal. Instead of go to field, use Set field to set a field in that related record to a value and then a related record will be created.
Interacting directly with a portal often isn't the best way to use to create related records. The script used can easily be broken by layout changes as it's very "layout specific".
There are other ways to script the creation of a related record. A script can capture the layout record's primary key in a variable, change layouts to one based on the portal's table, creates a new record, sets the foreign key to the variable's value and then returns to the original layout. (The user does not see the layouts change.)
There are also ways to set up a special relationship to a different occurrence of the same portal table that can then be used to create the new related record without changing layouts and without interacting with the portal.
Also make sure in your relationship set up, on the portal side, you have checked the box 'Allow creations of records..."
My initial post was not worded correctly. I didn't expect the script to create a new record, I expected it go to an empty record.
As it turns out I didn't have the correct relationship set up.
Thank you both for the input
Retrieving data ...