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

Extend Contract Class in D365 FO to add a new parameter

(0) ShareShare
ReportReport
Posted on by 10

Dear Gents,

I am trying to Extend the contract class of the Customer Account Statement report in order to add a new Parameter ( NoYes Parameter ), i am using the following code:

[ExtensionOf(ClassStr(CustAccountStatementExtContract)) ]
final class CustAccountStatementExtContract_Extension
{
    private NoYes IncludeVendTrans;


    [DataMemberAttribute("IncludeVendTrans")]


    public NoYes parmIncludeVendTrans(NoYes _IncludeVendTrans = IncludeVendTrans)
    {
        IncludeVendTrans = _IncludeVendTrans;
        return IncludeVendTrans;
        
    }
}

i am being able to call the parmIncludeVendTrans in the DP extension class, but i am not able to see the parameter on the report dialog or in the parameter group of the report.

any Idea why it is not appearing ? Am i missing something ? Really Appreciate your help guys.

Thank you For Your Support.

  • Verified answer
    sylvesterPowerBi Profile Picture
    380 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    i figured it out by using this code:

    [ExtensionOf(ClassStr(CustAccountStatementExtUIBuilder))]

    final class CustAccountStatementExtUIBuilder_Extension

    {

      private DialogField IncludeVendTransField;

       private NoYes IncludeVendTrans ;

       //[Wrappable(false)]

      public void build()

      {

          contract = this.dataContractObject() as CustAccountStatementExtContract;

          IncludeVendTransField = this.addDialogField(methodStr(CustAccountStatementExtContract, parmincludevendtrans),contract);

           next build();

      }

       public void getFromDialog()

       {

           contract = this.dataContractObject() as CustAccountStatementExtContract;

           IncludeVendTransField = this.bindInfo().getDialogField(

           contract,

           methodStr(CustAccountStatementExtContract, parmincludevendtrans));

           IncludeVendTrans = IncludeVendTransfield.value();

           next getfromdialog();

       }

    }

    Thank you Guys for your time

    Regards,

  • Sergei Minozhenko Profile Picture
    23,083 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi Tiesto

    You could try this.

    [ExtensionOf(ClassStr(CustAccountStatementExtUIBuilder))]

    final class CustAccountStatementExtUIBuilder_Extension

    {

     //private DialogField IncludeVendTransField;

     // public  void build()

     //{

            next build();

     //    contract = this.dataContractObject() as CustAccountStatementExtContract;

     //    IncludeVendTransField = this.addDialogField(methodStr(CustAccountStatementExtContract, parmincludevendtrans),contract);

     //}

    }

  • sylvesterPowerBi Profile Picture
    380 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi

    Yes i tried,below is my code:

    [ExtensionOf(ClassStr(CustAccountStatementExtUIBuilder))]

    final class CustAccountStatementExtUIBuilder_Extension

    {

      //private DialogField IncludeVendTransField;

      // public  void InitValue(NoYes IncludeVendTrans)

      //{

      //    contract = this.dataContractObject() as CustAccountStatementExtContract;

      //    IncludeVendTransField = this.addDialogField(methodStr(CustAccountStatementExtContract, parmincludevendtrans),contract);

      // next InitValue(IncludeVendTrans);

      //}

    }

    can you please advise if i am missing something ?

    Regards,

  • Sergei Minozhenko Profile Picture
    23,083 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi Tiesto

    Have you used the same approach as described in docs (docs.microsoft.com/.../method-wrapping-coc) to create extension class, add CoC method for "build" and add new field (custom code) after next statement.

    BR, Sergei

  • sylvesterPowerBi Profile Picture
    380 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi Sergey,

    I have extended the CustAccountStatmentExtUibuilder class and added my contract, it is still not showing.

    i tried 2 ways , first way CoC, it returned an error with the next "The next method cannot be invoked  because it's not a Chain Of Command Method "

    And the second way is extending the class using extends.

    In both cases the parameter didn't show up in SSRS parameter, can you please advise how to extend the UI class using coc ?

    Regards,

  • Suggested answer
    Sukrut Parab Profile Picture
    71,637 Moderator on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Usually refreshing report data set should help you. Try restarting reporting service and then run query wizard again and restore data set and check if it is visible.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,083 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi

    Have you checked CustAccountStatementExtUIBuilder class? You can try to add your field to the dialog directly via CoC, but i'm not sure if selected value will be transfered to DP class correctly.

    BR, Sergei

  • Blue Wang Profile Picture
    on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi Lieutenant,

    I have checked CustAccountStatementExtContract class. It doesn't implement SysOperationInitializable interface.

    So, You can try what the article says,The only solution that worked was simple as a brick: an inline assignment of the respective field variable.

    Make the parameter active by default.

    The worst decision may recreate a report.

  • The Bad Lieutenant Profile Picture
    10 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi Sergey,

    the contract parameter is not showing in the report parameter itself, i have already refreshed the original Report dataset and the copied one,but nothing has showed up.

    How is it possible to show the parameter on report parameter ?

    Thank you

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,083 on at
    RE: Extend Contract Class in D365 FO to add a new parameter

    Hi

    I'm not sure if SysOperationInitializable will help in this case as it's the interface that brings "Initialize" method to initialize default values.

    Parameters for SSRS report should be visible on SSRS report parameters itself to be shown in the dialig and if you add a new parameter for the contract, you need to refresh data source in SSRS report and in case of a standard report it's not possible because SSRS reports are not supported for extensions.

    But you could always make a copy of the report and use it instead of a standard one.

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

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

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

#1
Jahanvi Profile Picture

Jahanvi 35

#2
PJ JohnPaul Profile Picture

PJ JohnPaul 5

#3
Anton Venter Profile Picture

Anton Venter 4 Moderator

Product updates

Dynamics 365 release plans