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

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,827 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

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 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans