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

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.

  • Jakub33 Profile Picture
    5 on at
    RE: Adding a field with PurchId to PurchReqTableAll

    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

  • Verified answer
    GirishS Profile Picture
    27,825 Moderator on at

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,011 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans