Hi All,
Can anyone tell me how to release a Sales order from code. I have Navision 2016 and I created a Code unit. In my Code Unit I want to trigger the release which is located on the Sales order Page.
Thanks all,
Mohamed
*This post is locked for comments
M Zayed sir can you please share the code i also need this code
One comment I am Releasing in another company and this is my code:
SalesHeaderRec.CHANGECOMPANY('Company 2');
SalesHeaderRec.GET(SalesHeaderRec."Document Type"::Order,SalesHeaderRecNo);
ReleaseSalesDocument.PerformManualRelease(SalesHeaderRec);
THANKS ALOT , I solved the issue, I just had to Change the company for the Sales line record before I release. So now everything is fine :)
This is exactly were the error is coming (IF NOT SalesLine.FIND('-') THEN).
The Problem is that Navision set a filter on Sales line "Document Type" = Quote! And usually all my created sales line have type order.
Why the manual release function looks only for Sales lines Type = Quote? Should not it look for type = Order?
Do you mean that Particular Sales Order is showing error message when you try to release from code, however the same is working fine via RTC client?
Ideally this should not happen.
This normally happens, when you do not have any Items or Quantity to be released for further process.
Following is the code for such error message in CU 414.
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
SalesLine.SETFILTER(Type,'>0');
SalesLine.SETFILTER(Quantity,'<>0');
IF NOT SalesLine.FIND('-') THEN
ERROR(Text001,"Document Type","No.");
Text001 - There is nothing to release for %1 %2.
Just one last question. I am always getting this error when try to release the document from Code "There is nothing to release". But when I go to the sales order and I try to release it from the RTC its working.
Do you have an idea why I am getting this error ?
Thanks alot, it worked like magic :)
You can use following code.
ReleaseSalesDoc.PerformManualRelease(Rec);
Where ReleaseSalesDoc is Codeunit "Release Sales Document" and Rec is your Sales Header Record.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156