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.

I have the same question (0)
  • Blue Wang Profile Picture
    on at

    Hi Lieutenant,

    Have you read this blog ?

    http://erconsult.eu/blog/extending-sysoperation-contracts-with-datamemberattribute/

    It mentioned

    "The class should be declared with the SysOperationInitializable interface, and amended by an initialize() method.

    However, if the original class did not implement SysOperationInitializable, your extension cannot do any better.

    The only solution that worked was simple as a brick: an inline assignment of the respective field variable".

  • The Bad Lieutenant Profile Picture
    10 on at

    Hi Wang,

    Can you be more precise where i should intialize SysOperationInitializable ?

    cause when i wrote it here [ExtensionOf(ClassStr(CustAccountStatementExtContract)),SysOperationInitializable ] it returned an error : The name 'SysOperationInitializable' denotes a class that is not derived from the 'SysAttribute' class.

    can you advise please where to intialize this method ?

    Thank you

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    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.

  • The Bad Lieutenant Profile Picture
    10 on at

    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

  • Blue Wang Profile Picture
    on at

    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.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    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

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    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.

  • sylvesterPowerBi Profile Picture
    384 on at

    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,

  • Sergei Minozhenko Profile Picture
    23,093 on at

    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
    384 on at

    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,

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans