Skip to main content

Notifications

Supply Chain Management forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Trade agreement journal values on Sales Lines

Posted on by 99
I am trying to find how the line amount is populating on sales line (Unit Price) when a trade agreement is  defined for that particular item, also if i post a trade agreement with same item say Item123 twice and define the price in Trade agreement 1 as 10 and in trade agreement 2 as 20 then if i post a sales order with item123 then everytime it will auto populate the sales line as unit price as 20 only.
Also if i click on SalesOrderLine in the ribbon and navigate to Price Details (MCRPriceHistory) then i can see only 1 trade agreement line, how is this possible also how is the trade agreement journal is coming up over there?
 
To sum up the above paragraph, Can someone help me in understanding this & finding the related objects, classes, x++ code for below :
1. How is trade agreement journal is getting related to sales orders when we navigate to price details, how and where does the value comes from
2. How to fetch the value of all the fields in trade agreement journal line to sales line, where to add the x++ code 
 
Please try to understand my requirement, Say i have 3 custom fields on Trade agreement journal line say Field1, Field2 and Field 3 added on PriceDiscAdmTrans.Extension, and I create a trade agreement for Item123 and give the value of Field1 = 10, Field2 = 20 and Field3 = ABC and post the journal.
 
I have the same fields Field1, Field2, Field 3  and JournalNumber custom fields added on SalesLine.Extension
 
Now when i create a sales order line with the same item which is Item123 i need these feilds on sales line to have a value autopopulated from trade agreement which will be:
Field1 = 10
Field2 = 20
Field 3 = 30
JournalNumber = ABC001 (Trade agreement journal number)
 
How do i achieve this using x++ code and where should i write my code which class which method??

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans