web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Add new field to VendTransOpenPerDate Report by extending VendTransOpenPerDateDP class

(0) ShareShare
ReportReport
Posted on by 186

Hi,

 

I am attempting to add new fields to the VendTransOpenPerDate Report by extending the VendTransOpenPerDateDP class. I am using CoC and implementing my change in the setVendTransOpenStmtTmp(). The problem I am running into is that the vendTransOpenStmtTmp table is declared as a private variable in the standard class.

 

I have noticed that there is a getVendTransOpenStmtTmp() on the DP class which I have attempted to leverage in order to get the correct table buffer, but this results in the report returning no data.

 

Other solutions I have tried is to add my logic to the insertVendTransOpenStmtTmp() on the DP extension, but I am unable to get context of VendTrans and VendTable in this method as the get* methods for these 2 tables are also private.

 

I also tried setting the standard setVendTransOpenStmtTmp() fields in my CoC field, this does return the correct data in the sense of the report included the standard fields as well as my new fields but there are some fields I am unable to access still due to private declarations and it duplicates some of the rows.

 I have added my extension class code below

If anyone has any experience extending this DP class or might have some guidance it would be greatly appreciated.

[ExtensionOf(classStr(VendTransOpenPerDateDP))]
final class KRCVendTransOpenPerDateDP_Extension
{
    protected void setVendTransOpenStmtTmp(VendTable _vendTable, VendTrans _vendTrans)
    {

        DimensionDefault                   defaultDimension;
        DimensionAttribute                 project;
        DimensionValue                     ProjectVal;
        ProjName                           projName;

        #define.Project('Project')

        next setVendTransOpenStmtTmp(_vendTable, _vendTrans);

        CustVendTransOpenStmtTmp _vendTransOpenStmtTmp = this.getVendTransOpenStmtTmp();

        DimensionAttributeValueSetStorage dimStorage = new DimensionAttributeValueSetStorage();

        defaultDimension  = _vendTrans.DefaultDimension;

        dimStorage        = DimensionAttributeValueSetStorage::find(defaultDimension);

        project           = DimensionAttribute::findByName(#Project);
        projectVal        = dimStorage.getDisplayValueByDimensionAttribute(project.recId);

        projName          = ProjTable::find(projectVal).Name;

        _vendTransOpenStmtTmp.KRCProjName      = projName;
        _vendTransOpenStmtTmp.KRCVendGroup     = _vendTable.VendGroup;
        _vendTransOpenStmtTmp.KRCTaxAmount     = TaxTrans::find(_vendTrans.Voucher, _vendTrans.TransDate).TaxAmount;

    }

}

I have the same question (0)
  • Verified answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Have you tried oninserted or oninserting event handler?

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Justin, setVendTransOpenStmtTmp method seems to be right choice. May I know which private fields you need to access and how come extending this method will create duplicate rows.

  • Suggested answer
    Justin Kruger Profile Picture
    186 on at

    Hi Bharani,

    I did indeed not think of this... I have implemented your suggestion of using an onInserting event handler and it works perfectly. Thank you for your speedy and helpful response.

  • Justin Kruger Profile Picture
    186 on at

    Hi Mohit,

    Thank you for your response, the private variable in this case is the Temp Table declaration in the standard DP class.

    Bharani suggested I use a eventhandler and this did indeed solve my problem.

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…

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
André Arnaud de Calavon Profile Picture

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

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 437 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans