I am in Sales Order form and I have created a new codeunit which do some calculations.
Both of them have as table source the Sales Header table.
I am sending Sales Order REC (which is the Sales Header table) to the codeunit, I do my calculations and I put the values in some fields in the same table.
When I return to Sales Order form, even if I press Refresh I cannot see my values.
I stopped the code on OnModify trigger of Sales Header table but it never go there. I tried to use LOCKTABLE and MODIFY inside the codeunit but I get the error 'You cannot make any changes to the database until a Transaction has been started'.
I also tried COMMIT but no luck.
Is there a way to modify my fields inside the codeunit and using refresh to see them in the form?
How can I start a transaction?
Why when I do this on a form it works?
kirkostas™
0
Comments
It may be that you need to save the record before passing it!
As a guide look for something that does what you want to do, send a sales header and have a modified record returned, so with that in mind, look at the call to the Release Codeunit, and how this works, this sends back the modifed record to the form.
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
Yes I understand that the problem is that the record is locked by the form
and I am not be able to modify it.
How can I save the record before passed it?
Let me explain what I want to do.
Sales Order has a sub form Sales Line.
So I want every time the user enter a new record in Sales Line sub form to run my codeunit which is Sales Header table, do some calculations, pass the values in my new fields, update the table and when got back to Sales Order form to see the modifications.
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
When the user is entering the data in the Sales header subform, it is not the sales header table but rather the sales line table. If you want to do some calculation based on the sales line and then update the sales header which ash got some new fields, there are various ways of acheiveing the same. But first we all need to know what exactly are you trying to update.
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/
Problem SOLVED.
Dynamics NAV Developer since 2005
You are trying to tell me the EXIT(TRUE) isn't safe enough?
Dynamics NAV Developer since 2005