Skip to main content

MS Dynamics 365 for Operations: Class extensions (ExtensionsOf[])

Hello J
I would be discussing on how easily classes can be extended in Dynamics 365 for Operations.
As we are aware that classes can be easily customizable by writing delegate and subscribing the method in the new extension class. But this could be sometime hectic and cumbersome as it consume lot of time when complex logic (Multiple scenarios or method) needs to be written. So in order to save time and effort, extension of class features can be easily adopted.
Below syntax shows you how we can write extensions of for a particular class:
Class Student
{
    real studentAge(int arg)
   {
    …
    }
}

[ExtensionOf(ClassStr(Student))]
class Student_Extension
{
    real studentAge (int arg)
    {
     var s = next studentAge(arg + 4);
   
      return s;
    }
}

We have observed a new keyword here “next” in the extension class. For the time being I would just say it creates a Chain of Command,  We will learn more about it in my next blog post. J

Comments