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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error in prePromptModifyContract() Controller Method

(0) ShareShare
ReportReport
Posted on by 147

Hi,

I`ve been struggling with a problem. I need to launch a SSRS report from a form. For this reason I`m using a Controller class, a Contract class and a Data Provider Class.

So I Implement an Output  menu item wich has a Class as an ObjectType Property and wich is MyController.

 Controller class simply gets Args from caller and sets parameters in  Contract class. The problem is that I can not add any parameter in my Controller.

So I had an error : HC_MonthlyDecContract object not initialised.

Any Help Please?

Thx,

MenuItemProperty.png

*This post is locked for comments

I have the same question (0)
  • Houda Chkoundali Profile Picture
    147 on at
    RE: Error in prePromptModifyContract() Controller Method

    Many Thanks Vilmos Actually I did't define  parameters in My report this is why I had the error "HC_MonthlyDecContract object not initialised." Again, Thanx

  • Houda Chkoundali Profile Picture
    147 on at
    RE: Error in prePromptModifyContract() Controller Method

    Many Thanks Pintu It is very helpfull :)

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Error in prePromptModifyContract() Controller Method

    The code above pasted by Pintu is expecting a record buffer in the caller argument.

    Again, the menu item should be used on a menuitembutton on your form, for which you need to override the clicked method in order to pass in additional arguments however you are expecting them.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Error in prePromptModifyContract() Controller Method

    Here is the piece of code,

    protected void prePromptModifyContract()

    {

       YourContractClass       contract;

       YourTable                    table;

        ;

       table= this.parmArgs().record();

       contract             = this.parmReportContract().parmRdpContract() as YourContractClass       ;

       contract.parmReclId(table.RecId);//Or any Unique Field you have.

       super();

    }

    By Using this Id, populate your temporary table in DP class.

    Hope it works.

  • Houda Chkoundali Profile Picture
    147 on at
    RE: Error in prePromptModifyContract() Controller Method

    Thank you Pintu. Would you please clarify more. How can I pass RecId from Args?

  • Houda Chkoundali Profile Picture
    147 on at
    RE: Error in prePromptModifyContract() Controller Method

    In my case, the report is generated directly from a menuitem So no need to use this code? if true, so the message error persists again and I can't found solution

    Thnx

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Error in prePromptModifyContract() Controller Method

    That solution is for using the report from a form, and you would override the clicked method of a form menuitem button control.

  • Houda Chkoundali Profile Picture
    147 on at
    RE: Error in prePromptModifyContract() Controller Method

    Thank You Vilmos. Actually I dont understand where I place the code

    "Args args = new Args();

    args.record(BHSDataTable);

    new MenuFunction(menuitemOutputStr(BHSMenuItem), MenuItemType::Output).run(args);

    "

    It mentionned on the clicked() method of the button you will use to run your reportbut I dont know where :(

    Thnx

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Error in prePromptModifyContract() Controller Method

    Here is a great example on how to do this. You are missing a couple of steps most likely where you pre-load the contract with arguments, and also you have to override the clicked method on the menuitembutton on your form and pass in the arguments you need:

    www.bhsolutions.com/.../how-to-launch-an-ssrs-report-from-ax-with-pre-loaded-parameters

  • Community Member Profile Picture
    on at
    RE: Error in prePromptModifyContract() Controller Method

    Create one parm method() in contract class for recId. Override method prePromptModifyContract() of Controller class and pass the recId from args.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
KP-31070522-0 Profile Picture

KP-31070522-0 3

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans