Customizing Dynamics NAV
Discover different ways to customize the application to give you and your colleagues access to the features, functionality, and data that you need most.
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
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 and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
In Sales Header, we have included a new field Sales Type(Datatype: Option, Values: Normal, Tender, Special Order). On the item card besides the current Unit Price field (i.e., Normal) we have added two new unit price fields for Tender and Special Order.
THE ITEM CARD
THE SALES INVOICE
How can we update the unit price on the Sales Line when changing the Sales Type:
1) when adding a new item on the sales line, and
2) for existing lines when changing the sales type.
I've verified through the code unit 7000 Sales Price Calc Mgt which includes the function CalcBestUnitPrice.
The following changes were done (code between ME01-START & END) but the correct price is not being displayed:
Does anyone has any idea how same can be done.
Nav version: 2013R2
Thanks & regards
I did not notice the Get Statement for the SalesHeader, i think you should use get SalesHeader first using
SalesHeader.GET("Document Type","Document No.").
The other thing is there is a function called UpdateSalesLines on Sales Header table you should use the same kind of logic on the Sales Type field to update the sales lines.
Call that function on the validate of the sales type field and add code on the updatesaleslines function for the FIELDCAPTION("Sales Type"):
Yes, as mentioned by Suresh, you need to check whether the Sales Header has the record by calling the SalesHeader.GET(......).
Thanks for responding to my query.
However, when the FIELDCAPTION was used, the unit price is not being updated when changing the 'Sales Type' on the Sales Header. Please find below the code and the debug screen:
Do you have any idea how to correct same
It looks like your code is executed, does it not hit your IF statement where you added the unit price code?
One other thing you don't need SalesLine.SETRANGE(".....) statement
If you look at the above code, the Debugger shows that the Item table is not initialized. How you got the Item record by using IF Item.GET(SalesLine."No.") THEN; ?
Thanks MMV, in fact I was missing the condition IF Item.GET(SalesLine."No.") THEN
You are welcome!!!
I was trying to copy Document date field of Sales header to a newly created field Job activity field of Sales Line. I'm writing following code in UpdateSalesLines and it is throwing "the return value should be used for this function" at FIELDCAPTION method. Below is my code
FIELDCAPTION("Document Date") : SalesLine."Job Activity Date";
I'm calling the method in Validate as
Document Date - OnValidate()
Business Applications communities