and the second attachment..
and the third attachment. I don't know how to put all images in one post.
Hard for me to quite figure out your question, but what happens if you put a 'Commit Record' Script step after your 'Set Field...' Script Step? And you may need a 'Refresh Window' Script Step after "Go to Layout'.
I tried with a script from the forum but I don't have the result I want. All it does is to create a new entry in "ConstatariOrganizatorice" with "_PvcIDFk" field completed and rest of them empty.
The script is doing exactly what it was written to do: Creates a new record in the portal row linked to the current record in the Layout's table. What else do you need it to do?
Also, it adds an empty row in the portal.
It looks like you enabled the "allow creation of record via this relationship" for the portal's Tutorial: What are Table Occurrences?. This causes a special, empty appearing, "add row" to appear below that last actual record shown in the portal. If you click or tab into this portal row, a new record is automatically created and the "_PvcIDFk" field in this table will automatically get a matching value to link it to the current record in the layout's table.
You really don't need both the script and this "allow creation feature". Usually, you use one or the other to create a new related record.
Sorry if I didn't make myself understood. The layout in 1st attach is based on PVC table. The "Organizatorice" tab contains fields coresponding to "ConstatariOrganizatorice" table. Also, the portal in the bottom of the layout shows record from the same table. When typing in every field, after pressing tab key, the portal record updates, and I don't want this. When "Ok" button is pressed I want to:
1. all the fields to complete the record in "ConstatriOrganizatorice" table
2. the record to be shown in the portal
3. a new empty record to be created in "ConstatariOrganizatorice" table
4. all the field in "Organizatorice" tab to be empty, ready for editing.
Then the fields in the upper part of the tab panel should not be the exact same fields shown in the portal. Define a set of fields for use in the upper part with global storage. Add set field steps to your script to copy the data from the global fields into the fields of the new record created in your portal. And additional set field steps can clear fields by setting them to "" so you can clear the global fields after creating the new portal record.