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

extension of SalesHeadingController class

(0) ShareShare
ReportReport
Posted on by 110

Hi Everyone,

I have added some fields for the SalesHeading Report and also written extension code for the salesHeadingController. the code shown below.

class SalesHeadingControllerExt extends SalesHeadingController
    {
           public static SalesHeadingControllerExt construct()
           {
                  return new SalesHeadingControllerExt();
           }

           public static void main(Args _args)
           {

                SalesHeadingControllerExt controller = SalesHeadingControllerExt::construct();
                controller.init(_args);
                controller.parmReportName(ssrsReportStr(NS_SalesHeading, Report));
                controller.startOperation();
            }

  }

the code build successfully but when I debug the code its not triggering. I'm trying to customise the following report.  

I guess, when we select the sales order per customer(Menu Item), salesheading report will execute. 

Please help me with the right approach.

pastedimage1644902190276v2.png

Many thanks 

Sheshu Nara

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    What you wrote isn't an extension of SalesHeadingController class. Instead, you've created a new class inheriting from SalesHeadingController.

    Unless you write some other code using this class, the class isn't used and therefore it has no effect whatsoever.

    An extension would be defined it this way:

    [ExtensionOf(classStr(SalesHeadingController))]
    final class MySalesHeadingController_Extension
    {
    }

    You can find more information in F&O documentation: Class extension - Method wrapping and Chain of Command.

  • Seshu Nara Profile Picture
    110 on at

    Hi Martin, I have got the following error. could you please help with this.

    pastedimage1644980168505v1.png

    in the standard controller class there is no outpurreport method, maybe the reason its showing the error.

  • Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    Where did you find outputReport() method. I see it neither in SalesHeadingController not its parent classes, therefore it indeed doesn't seem to exist.

    What if you try initializeParameters() instead?

    protected void initializeParameters(boolean _calledFromInitParmDefault)
    {
    	this.parmReportName(ssrsReportStr(XyzSalesHeading, Report));
    	super(_calledFromInitParmDefault);
    }

  • Seshu Nara Profile Picture
    110 on at

    Hi Martin,

    Thanks for the kind response.

    I have tried the above code, i got the following error.

    pastedimage1645004677549v3.png

    i also called the next (),this the error below.

    pastedimage1645004917451v5.png

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

    Oh, sorry, this is indeed a bug.

    super() is used with inheritance, while we need 'next' in extensions:

    protected void initializeParameters(boolean _calledFromInitParmDefault)
    {
    	this.parmReportName(ssrsReportStr(XyzSalesHeading, Report));
    	next initializeParameters(_calledFromInitParmDefault);
    }

  • Seshu Nara Profile Picture
    110 on at

    Thanks Martin, code was build successfully and when I debug the code it's triggering but not executing the customised report, its still executing the standard report.

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

    If I was you, I would debug the code to see where the value changes.

    By the way, I looked into SalesHeadingController class and noticed that it has init() method, where the standard code sets the report name. It runs before initializeParameters(), therefore it shouldn't be the cause of this problem, but it would make logical sense to put our logic at the same place.

  • Seshu Nara Profile Picture
    110 on at

    Thank you so much Martin

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans