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 :
Finance | Project Operations, Human Resources, ...
Answered

Data entity extension for Vendor party base type

(0) ShareShare
ReportReport
Posted on by 392

We've created a data entity to provide details of vendor transactions, and one of the fields required on the data entity is the vendor type (organisation or person). Party base type doesn't seem to be a database field (happy to be told I'm missing something), so we've ended up with a computed field in the data entity that feels more clunky than I'd like. Other than better use of SysComputedColumn to construct the outer joins, anyone have a smoother way to get this please?

public class CUSVendorTransactionEntity extends common
{
    public static server str VendorPartyType()
    {
        DataEntityName  dataEntityName= tablestr(CUSVendorTransactionEntity);
        str             AccountNum;
        str             qry;

        accountNum = SysComputedColumn::returnField(DataEntityName, identifierstr(VendTrans), fieldstr(VendTrans, AccountNum));

        qry = strFmt("select case when dpn.[recid] is null then 'Organisation' else 'Person' end from [VENDTABLE] vt inner join [DIRPARTYTABLE] dpt on vt.[PARTY] = dpt.[RECID] left outer join [DIRPERSONNAME] dpn on dpt.[RECID] = dpn.[PERSON] where vt.[ACCOUNTNUM] = %1", accountNum);

        return qry;
    }

}

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    304,553 Super User 2026 Season 1 on at

    Hi Rich,

    The party type is indeed not a database field. It is using an instance table ID as part of the table inheritance. You can consider using the same logic as Microsoft used themselves on the DirPartyBaseEntity:

    private static str partyType()
        {
            /*********************************************
            The following is an example of what the query string will look like, table id's may vary:
            
        CASE DirPartyTable.InstanceRelationType
            WHEN 11840 THEN 'Person'
            WHEN 1910  THEN 'Organization'
            WHEN 8099  THEN 'LegalEntity'
            WHEN 7525  THEN 'OperatingUnit'
            WHEN 6237  THEN 'Team'
            ELSE ''
            END
            *********************************************/
            Map partyTypesMap = DirUtility::getPartyTypeNames();
    
            return SysComputedColumn::switch(
                SysComputedColumn::comparisonField(tableStr(DirPartyBaseEntity), tableStr(DirPartyTable), fieldStr(DirPartyTable, InstanceRelationType)),
                partyTypesMap,
                SysComputedColumn::returnLiteral(''));
        }
    

  • Rich Profile Picture
    392 on at

    Thanks André. Good reminder that there's normally a precedent somewhere.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 606 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 356

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans