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

  • Seshu Nara Profile Picture
    110 on at
    RE: extension of SalesHeadingController class

    Thank you so much Martin

  • Verified answer
    Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: extension of SalesHeadingController class

    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
    RE: extension of SalesHeadingController class

    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
    231,837 Most Valuable Professional on at
    RE: extension of SalesHeadingController class

    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
    RE: extension of SalesHeadingController class

    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

  • Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: extension of SalesHeadingController class

    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
    RE: extension of SalesHeadingController class

    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.

  • Suggested answer
    Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: extension of SalesHeadingController class

    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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,837 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans