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

Data entity extension for Vendor party base type

(0) ShareShare
ReportReport
Posted on by 326

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
    301,130 Super User 2025 Season 2 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
    326 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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans