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 :
Dynamics 365 Community / Forums / Finance forum / InitFrom... method in ...
Finance forum

InitFrom... method in Extensions

(0) ShareShare
ReportReport
Posted on by 625

Hi

I created an extension to the purchline table (new field) and I want to set a value during the initFromProject method. Therefore I created a class where I added the post-eventhandler for the initFromProjTable Method

How can I now access the projTable parameter passed to the base method?

I have the same question (0)
  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi,

    Are you working with AX2012 or D365FO?

    Best regards,

    Ludwig

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Since you talk about extensions, I guess your question is about D365FO, not AX. I will move this post to the correct forum.

    You can get the parameter from the event args, by calling args.getParm("parameterName");

  • Verified answer
    Martin Dráb Profile Picture
    237,972 Most Valuable Professional on at

    A much easier and safer approach is using Chain of Command - then you can simply refer the parameter by name and you don't have to hard-code parameter names as text (or parameter index).

    Here is an example:

    [ExtensionOf(tableStr(PurchLine))]
    final class MyPurchLine_Extension
    {
        void initFromProjTable(ProjTable _projTable, boolean _updateSalesPriceOnly)
        {
            next initFromProjTable(projTable, updateSalesPriceOnly);
            
            this.MyField = _projTable.MyField;
        }
    }

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans