Release - OnAction() //trigger ReleaseSalesDoc.PerformManualRelease(Rec); #CustomCodeinto
Release - OnAction() //trigger PagePerformRelease; //############## PagePerformRelease() //global function ReleaseSalesDoc.PerformManualRelease(Rec); #CustomCode
SalesHeader.GET(DocType,DocNo) PageSalesOrder.SETRECORD(SalesHeader); PageSalesOrder.PagePerformRelease;
Answers
Thanks for your reply. I could call codeunit 414 to release the Sales Order Document. But sometimes we will program some code in "Release Action" on the Sales Order page for validate or do something between user press the Release action and the action to call codeunit 414. Therefore, if i call the codeunit 414 directly. Those code in "Release Action" which before the action to call codeunit414 will not be access.
I think the best way is to call Sales Order Page "Release Action" directly. But it seems not possible.
Do you have any ideal to do this?
Basically, the idea is that you would turn into
And then in your codeunit you do:
Of course, if you're making such changes, it'd be better to take the "PagePerformRelease" function and put it into some codeunit, then you wouldn't need this workaround.
Well, don't do this. Put them into a function and make the action call that function. Even putting that function on the Page solves it, but it is not ideal.
Think like this: suppose you take over support of this customer from another NAV partner. You run the Release codeunit by code and you don't even know that there is custom code on the page. So try to put it into a place where it gets noticed. Put the code into the release codeunit. Put the code into a custom object and just call the function from the release codeunit -> easier upgrade. If on a newer version, see if the release codeunit has events, and implement them. That is the best upgrade-friendly. Just putting code right into that Page Action is not the kind of thing a professional consultant does.
The reason you cannot call actions by C/AL is entirely intentional, it is to discourage you to put anything but function calls into them.
Thanks for your reply.Your suggestion is very important key thinking point.Both of you are expert in NAV ERP.I will follow your suggestion to make sure programming team members work smoothly.
Thanks both of you again.