Breaking news from around the world
Get the Bing + MSN extension
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
As m new to nav i need to restrict the salesline . that is a customer should order only three lines if he tries to order fourth item it should show error. please can any one give the code
In the OnInsert trigger of Sales Line, count the number of lines using filters Document Type and Document No., if the count is more than 3 then throw an error.
SalesLine.Setrange("Document Type", SalesHdr."Document Type");
SalesLine.Setrange("Document No.", SalesHdr."No.");
if SalesLine.Count > 3 Then
error('You can only insert 3 lines into an Order');
i created a new codeunit and pasted the code and the codeunit should call it in release tab on the sales order page
You need to add that code in the table itself or call the function which you have created in the table. If you open the table you will find the triggers , add it in the OnInsert trigger
Make sure to filter the No. as well. Otherwise you will have problem with empty line.
Also filter the Type as Item if you want it to count only item.
SalesLine.Setrange("Document Type", SalesHeader."Document Type");
SalesLineSetrange("Document No.", SalesHeader."No.");
ERROR('You can only insert 3 lines into an Order');
i created a new codeunit and pated the code in that call that codeunit in salesorder page realese tab but its not working
Onevent.run is my codeunit and running it in release tab of salesorder.
If you created a new Codeunit, then you must pass the Sales Header record as Parameter to the Codeunit.
Go to Codeunit properties and set the TableNo property to Sales Header
When you run the Codeunit, use Rec variable to run the codeunit.
In the Codeunit, instead of SalesHdr variable use Rec for filtering.
thanks its working . how can i check if the same customer must order more than three items seperately. like if i click new customer in sales order i order i item and again new sales order the same item . i should not order like that . can u tell me how can i do this
It is too late for you to place that function in the Release and otherthing try to create a function in the codeunit and call that function, don't just call it codeunit.run.
Put it before the ReleaseSalesDoc.PerformManualRelease, not after.
Thanks i got it . but now in the same i need to restrict the customer also like one customer should not order the item more than one time. how should i restrict the customer .can you pls tell
Business Applications communities