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)

Class extensions in D365

(0) ShareShare
ReportReport
Posted on by 501

Hi all,

I am working with class extensions. I have studies some very helpful articles about class extensions.

We can add new instance and static variables and methods in class extension. But is there any way to modify or override an existing method in the extension class ??
e.g. 

There is a class named DmfIntegrationBridge and it has a method named getJobStatus, so i want to override this method in a way that i want to return some extra information from this method. So is there any way to do this?

We are going to restoring below 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    300,088 Super User 2025 Season 2 on at
    RE: Class extensions in D365

    Hi Shahrukh,

    It really depends on the details what you want to achieve. If you can use e.g. a post event handler and want to execute some additional tasks, then it is possible. You have to explain what exactly you mean with "return some extra information". Where and what for will this be used?

  • Verified answer
    Martin Dráb Profile Picture
    236,960 Most Valuable Professional on at
    RE: Class extensions in D365

    You asked the same question below my blog post about class extensions, so let me copy my reply here too:

    If you want to override a method, create a new class extending the base class and override the method. Inheritance (parent / child relationship and overriding) isn’t related to extensions.

    If you want to run some extra code on the beginning or the end of the method, you can also use events. You don’t need class extensions for this either.

  • Shahrukh Profile Picture
    501 on at
    RE: Class extensions in D365

    This getJobStatus method is returning DataJobStatusDetail object. and this class contains a member variable named ExecutionLog, I need to append some information in this ExecutionLog, so that it will return detailed information.

  • Martin Dráb Profile Picture
    236,960 Most Valuable Professional on at
    RE: Class extensions in D365

    You can apply techniques we already mentioned, such as a post-event handler.

  • Shahrukh Profile Picture
    501 on at
    RE: Class extensions in D365

    Thanks Martin and Andre,

    My case was related to Post-Event handler and it is resolved. :)

  • geminikartik Profile Picture
    241 on at
    RE: Class extensions in D365

    HI Shahrukh ,

    Have you ever faced below error or system exception while running export Recurring data job from Ax . We are having this outbound integration and when 3rd party application is trying to download zip file from blob provider , they are getting 500 internal system error and even as part of manage messages , I am able to see only Processed message status but not downloaded.

    I checked back in event viewer and got below exception details .

    EventData>

      <Data Name="ComponentName">ActivityRuntime</Data>

      <Data Name="exceptionMessage">System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.String.Format(IFormatProvider provider, String format, Object[] args) at Microsoft.Dynamics.Platform.Integration.Connectors.Runtime.IntegrationActivityRuntimeCodeMarker.WriteUnhandledException(Exception exception, String message, Object[] args) at Dynamics.AX.Application.DMFIntegrationBridge.`Export(IntegrationBridgeContract bridgeContract) in xppSource://Source/ApplicationFoundation\AxClass_DMFIntegrationBridge.xpp:line 96 at Dynamics.AX.Application.DMFIntegrationBridge.DMFIntegrationBridgeCoCHelper.`Export(DMFIntegrationBridge instance, IntegrationBridgeContract arg0) at Dynamics.AX.Application.DMFIntegrationBridge.Export(IntegrationBridgeContract bridgeContract) at Microsoft.Dynamics.Platform.Integration.Connectors.Runtime.IntegrationActivityRuntime.<Export>d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Platform.Integration.Connectors.Runtime.IntegrationActivityRuntime.<ExecuteIntegrationAsync>d__21.MoveNext()</Data>

      <Data Name="infoMessage">Unhandled exception processing 'Id = 5637146826, Name = Test Outbound, Direction = Outbound, Data project = Test outbound'.</Data>

      </EventData>

    Somewhere DMFIntegrationBridge class failing during export operation. Please suggest .

  • Ehtasham Rahman Profile Picture
    672 on at
    RE: Class extensions in D365

    Hi Shahrukh,

    Can you please paste the snapshot of your code which you have written to append some information with member variable of getJobStatus method? Actually I am trying to do same work but I don't know how to get the member variable in postEventHandler and assign it new value.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans