web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Customer TradeAgreements Tables

(0) ShareShare
ReportReport
Posted on by 40

Hello, I am a .NET Developer. Recently we got a small pilot project from one of our clients. They

have implemented sales and hr modules using AX 2009. 

The requirements is like this - 

Using .NET Application we have to display the customers and their trade agreements, out-standing
Invoices and data must be saved into an XML document.

We found customer (CustTable) and their invoices(CustTrans and CustTransOpen) tables in SQL Server.

But we are not able to find the any relation between trade agreement table (PriceDiscTable) and Items table
(InventTable).

Please help me in finding the correct tables and procedure required to  extract customer trade agreements and
associated items.

Thank you.

 

 


*This post is locked for comments

I have the same question (0)
  • Alex Prodan Profile Picture
    on at

    Hello,

    Before discussing Ax internal table structure and relations, please investigate if the default AIF services that are provided with Ax satisfy your requirements: http://msdn.microsoft.com/en-us/library/aa859008.aspx. From that list, you might be interested in price list service: http://msdn.microsoft.com/en-us/library/cc967365.aspx.

    In case the default AIF services do not satisfy your requirements, have you considered creating custom AIF services? (its a breeze using the create document service wizard) You can try looking at already existing queries in AOT\Queries\PriceDisc*, and try creating AIF services based on those. The web services approach would also play nicely with your requirements to save XML documents. And while at AIF topic - I would be curious what other types of integration with Ax have you considered?

    And now about the PriceDiscTable: ItemRelation value is interpreted differently depending on ItemCode value. Here is a small table:

    ItemCode ItemRelation Agreement type

    All

    <blank>

    Total discount only

    Group

    Item line discount group (InventTableModule.LineDisc)

    Line Disc

    Item Multiline discount group (InventTableModule.MultiLineDisc)

    Multiline Disc

    Table

    Item Id (InventTable.ItemId)

    Line Disc, Price Disc

    Please note that InventTableModule holds line and multiline discounts for Sales and Purchase, and which module is considered depends on agreement type (sales or purchase).

    AccountCode and AccountRelation values of PriceDiscTable behave in a similar way.

    Again, I would stronly suggest to consider the options in the order they were presented. If you try to base you app on the Ax 2009 table relations your customers might have a hard time upgrading your solution to a new Ax version.

    BTW, if you are interested how Ax reads trade agreements, look at PriceDisc class.

    Let me know if these pointers were usefull.

    Regards,

    Alex

  • Laxmi Narsimha Rao Profile Picture
    40 on at

    Thank you very much Alex for the support.

    We had gone through using AIF and Web Services approach also. Though both of them can fullfill all the requirements that we need - there are some red-taped issues like do not connect to AX Application, just only a use mirrored AX Database. So it will just another .NET application with bizzare table names, columns and no relations at all (because I am bascially a non ERP developer and love to my RDBMS stuff).

    The information you have provided is splendid and again I will be thankful to  you. In our current pilot project we are just focusing on GROUP (RELATION=4) only.

    We wrote a query to relate the customer and his/her tradeagreements as follows

    SELECT * FROM  PRICEDISCTABLE
    WHERE ACCOUNTRELATION = 'CUST2' AND ITEMRELATION = 'ITEM001'
    AND DATAAREAID ='DAT' AND RELATION = '4'
    AND INVENTDIMID = 'TEST405'

    I hope the above query will solve our issue.  If possible please provide your opinion. Again thanks for the support.

  • Alex Prodan Profile Picture
    on at

    Hi Laxmi,

    Relation column is trade agreement type (line, multiline, price or total disocunt). I am not sure how GROUP fits into the relation column, so to make sure we are on the same page, let's come back to the original problem: "Get all trade agreements for a specific customer". To get this, we need to get all trade agreements for customer id, for customer line/multiline/price/total discount groups, and trade agreements applicable to all customers:

    SELECT * FROM PRICEDISCTABLE

    WHERE

    ((ACCOUNTCODE = 0 AND ACCOUNTRELATION = 'CustID') --Association via customer id, you need account code in there as Cust id can be qual to Cust discount group name

    OR

    (ACCOUNTCODE = 1 AND (ACCOUNTRELATION = 'CustLineDiscGroup' OR ACCOUNTRELATION = 'CustMultilineDiscGroup' OR ACCOUNTRELATION = 'CustPriceGroup' OR ACCOUNTRELATION = 'CustTotalDiscGroup')) --Association via customer Line/Multiline/Price/Total disc group

    OR

    (ACCOUNTCODE = 2)) --Association via discount for all customers

    AND

    MODULE = 1 --ModuleInventCustVend.Cust

    Note the query is for illustration purposes, and might be suboptimal - provided AS IS, without any warranties or guaranties.

    I did some investigation and it seems PriceList service is not callable from outside Ax (by design), but the other option of using AIF services remains - please try to push for that one, as you will most likely have a hard time developing against the Ax DB.

    Alex

Under review

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

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans