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

Adding a field with PurchId to PurchReqTableAll

(0) ShareShare
ReportReport
Posted on by 5

Hi everyone I'm new to dynamics and to x++.
I'm working on a project and I need to add a field showing purchase order ID (PurchId) in PurchRegTableAll I was told to use the display method just I'm confused about how to much correct PurchId with the corresponding PurchReqId inside the display method and which table should I extend in the class where the display methode gonna be.

I have the same question (0)
  • Verified answer
    GirishS Profile Picture
    27,843 Moderator on at
  • Jakub33 Profile Picture
    5 on at

    Thankyou Girish S for your help.

    I managed to accomplish the task as I found that PurchReqLine table contains a field PurchId and also a field PurchreqTable wish is RefRecId of purchreqTable
    then added the Fallowing code as Display method as class extension of PurchReqTabel

    [ExtensionOf(TableStr(PurchReqTable))]
    final class PurchReqTable_Extension
    {
    public display PurchId getPurchId()
    {
    PurchReqLine purchReqLine;
    PurchReqTable purchReqTable;

    select firstonly PurchId from purchReqLine
    where purchReqLine.PurchReqTable == this.RecId;

    return purchReqLine.PurchId;

    }

    }

    Then added a string field in PurchTabeList which is the form behind of the display menu Item PurchReqTableAll then set the Data source to PurchReqTbale and add the DataMethod PurchReqTable_Extension.getPurchId.

    for the purchTable  the task was easier as it contain both purchreqId and purchId so I just adde the fallowing cod as class extension

    [ExtensionOf(tableStr(PurchTable))]
    final class PurchTable_Extension
    {
    public display PurchReqId getPurchReqId()
    {
    PurchTable purchTable;
    PurchLine purchLine;

    select PurchReqId from purchLine
    where purchLine.PurchId == this.PurchId;
    return PurchLine.PurchReqId;
    }

    }

    and added a field in purchtable form and set the data source and the data method

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 493

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 242 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans