Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Add new field to VendTransOpenPerDate Report by extending VendTransOpenPerDateDP class

(0) ShareShare
ReportReport
Posted on by 80

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;

    }

}

  • Justin Kruger Profile Picture
    Justin Kruger 80 on at
    RE: Add new field to VendTransOpenPerDate Report by extending VendTransOpenPerDateDP class

    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.

  • Suggested answer
    Justin Kruger Profile Picture
    Justin Kruger 80 on at
    RE: Add new field to VendTransOpenPerDate Report by extending VendTransOpenPerDateDP class

    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.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,552 Super User 2024 Season 1 on at
    RE: Add new field to VendTransOpenPerDate Report by extending VendTransOpenPerDateDP class

    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.

  • Verified answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Add new field to VendTransOpenPerDate Report by extending VendTransOpenPerDateDP class

    Have you tried oninserted or oninserting event handler?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans