In NAV2016 I created a list page, that shows my projects. When I select a project, it will fill a second list page with some details of my project.
I created an action trigger to fill this, and this works smoothly.
Now I try to fill the same data out of the OnAfterGetCurrRecord trigger, and it shows an error stating: "A transaction should be started before changes in the database can be made". This error will *not* appear when my function does not make any changes to the data, but every delete/modify/insert will throw this error.
Is it true that you can not make changes to the database in the OnAfterGetCurrRecord trigger?
Is there a workaround?
IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
0
Answers
I'm not sure of your exact requirements but is it a possibility for you to populate a temporary table and show that on the second page? If you do this then it won't give an error because you are not writing changes to the database.
You can set the SourceTableTemporary of the page to "Yes" and then insert records into the Rec on the page. I normally do this by having a PopulateData() function on the list page which does this and then call this function from the OnAfterGetCurrentRecord trigger of the parent page.