Skip to main content

Notifications

Announcements

No record found.

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 275

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;
    }

}

  • Rich Profile Picture
    275 on at
    RE: Data entity extension for Vendor party base type

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

  • Verified answer
    André Arnaud de Calavon Profile Picture
    293,041 Super User 2025 Season 1 on at
    RE: Data entity extension for Vendor party base type

    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(''));
        }
    

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,041 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,860 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans