web
You’re offline. This is a read only version of the page.
close
Skip to main content
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,825 Moderator on at
  • 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

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

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

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 636

#3
Martin Dráb Profile Picture

Martin Dráb 553 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans