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

Add vendor name field to PurchLineDocument Query

(3) ShareShare
ReportReport
Posted on by 532
Hi Everyone,
 
I want to add the vendor name to the PurchLineDocument query so that it can be displayed in the workflow editor placeholder for the purchase order lines.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

I tried the following approach but it didn’t work for me.
[ExtensionOf(classStr(PurchLineDocument))]
 final class Test_PurchLineDocument_Extension
{

    

    public str parmVendorName(CompanyId _companyId, tableId _tableId, recId _recId)
    {
        PurchLine purchLine;
        VendTable vendTable;
        str vendorName;
        purchLine = PurchLine::findRecId(_recId);

        if (purchLine)

        {
            vendTable = VendTable::find(purchLine.VendAccount);

            if (vendTable)
            {
                vendorName = DirPartyTable::getName(VendTable.Party);
            }

        }

      return vendorName;
         


        

    }

}


 
However I added the VendTable and DirPartyTable as DataSouce to the query to get the vendor name but I have no idea how to correctly create the relationships between PurchLine, VendTable, and DirPartyTable.

Thanks
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
     
    Adding vendor name as parm should work. Did you build and sync your project after you created Test_PurchLineDocument_Extension class? if yes, try to sync build the model and Sync the Database.
     
     
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

  • D365FO Junior-Dev Profile Picture
    532 on at
    Yes I did both of them, I think my approche is not correct I am looking for a better solution.
  • Verified answer
    Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
    Hi,
     
    Change the return type of parmVendorName to Name instead of str, build and sync the project then try again.
     
    Or If you want to add fields to Query, the relation is start between PurchLine and VendTable on PurchLine.VendAccount == VendTable.AccountNum
     
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

  • Verified answer
    André Arnaud de Calavon Profile Picture
    305,150 Super User 2026 Season 1 on at
    Hi D365 Junior Dev.
     
    Can you please be more specific on the current behavior? What exactly do you mean by "didn't work for me"? Can you see a new field in the workflow editor or not? If yes, is the outcome wrong or do you get a runtime error? 
     
    Using the return type as mentioned by Waed, you will have a field label in the query. So this is recommended to change in your coding. The suggested data type mentioned by Waed will give a label Name. In case you want to have a field available for selection called Vendor name, you can search for an existing other extended data type or create a new one with that label. At least the VendName data type is also only showing Name
  • Verified answer
    Martin Dráb Profile Picture
    239,634 Most Valuable Professional on at
    By the way, you could simplify your code to this:
    [ExtensionOf(classStr(PurchLineDocument))]
    final class Test_PurchLineDocument_Extension
    {
        public str parmVendorName(CompanyId _companyId, TableId _tableId, RecId _recId)
        {
            PurchLine purchLine = PurchLine::findRecId(_recId);
            return VendTable::find(purchLine.VendAccount).name();
        }
    }
  • D365FO Junior-Dev Profile Picture
    532 on at
    Hi everyone @Martin Dráb @André Arnaud de Calavon @Waed Ayyad thank you for your answers at my first step I wasn't able to find the name of the vendor in the workflow placeholders after creating a custom EDT and setting the label text to Vendor Name I was able to locate the label.

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 April 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 802

#2
André Arnaud de Calavon Profile Picture

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

#3
Subra Profile Picture

Subra 534

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans