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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Relation companyInfo with OMOperatingUnit

(0) ShareShare
ReportReport
Posted on by 916

Hello ,

I'm looking how to use DirPartyTable  to get the relation between companyInfo and OMOperatingUnit 

I'm trying the bellow code but it return 0 record

SELECT * 

FROM DIRPARTYTABLE Party

    INNER JOIN MicrosoftDynamicsAx.dbo.DIRPARTYTABLE Common
		ON  Common.RECID = Party.RECID
		AND Common.INSTANCERELATIONTYPE = 2376

    LEFT OUTER JOIN MicrosoftDynamicsAx.dbo.DIRPARTYTABLE  OMOPerating 
		ON  OMOPerating.RECID	= Common.RECID
		AND OMOPerating.INSTANCERELATIONTYPE = 2377
		AND OMOPerating.RECID	= Party.RECID
    
	LEFT OUTER JOIN MicrosoftDynamicsAx.dbo.DIRPARTYTABLE CompanyInfo 
		ON   CompanyInfo.RECID = Common.RECID
		AND  CompanyInfo.INSTANCERELATIONTYPE = 41
		AND	 CompanyInfo.RECID	= Party.RECID
		AND  CompanyInfo.DATAAREA = 'USMF'


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    For AX 2012 R2/R3, inherited tables have been collapsed into their base table, so an OMOperatingUnit record is actually just a DirPartyTable record with an InstanceRelationType of 2377.

    The reason your query returns no results is because of the INNER JOIN to DirPartyTable with an InstanceRelationType of 2376, which is the table number for OMInternalOrganization.  There will never be any such records because that table is further inherited by OMOperatingUnit, etc.

    If you want DirPartyTable records that are actually OMOperatingUnit records, you simply have to use the following SQL.

    SELECT * 
    FROM DIRPARTYTABLE  OMOPerating 
    WHERE OMOPerating.INSTANCERELATIONTYPE = 2377;

    If you want DirPartyTable records that are actually CompanyInfo records, then use the following SQL.

    SELECT * 
    FROM DIRPARTYTABLE  CompanyInfo
    WHERE CompanyInfo.INSTANCERELATIONTYPE = 41;

    So in your example, the one record you appear to want can be fetched as follows.

    SELECT * 
    FROM DIRPARTYTABLE  CompanyInfo 
    WHERE CompanyInfo.INSTANCERELATIONTYPE = 41
      AND CompanyInfo.DATAAREA = N'USMF';

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans