DEV Community 👩‍💻👨‍💻


Posted on

Difference Between Function and Action in Dynamics World

I always forget which ones which and this does matter when we are coding against Xrm.WebAPI (JS). Also, it is a terrific interview question.


Functions are reusable blocks of code that do not have any side effects. Meaning after the execution of a function no record will be updated. WhoAmI is an example of a function. You would call the function with a GET and this is a very important feature of a function. Also to my understanding, you cannot create a custom function. Meaning all the functions are defined by MS. The list of all the functions are to be found here


Actions are blocks of reusable code that can or cannot have any side effects. (confusing much??). You can create custom actions and all the actions are called with a POST. An action can be bound to an entity and it is then called a bound action. An action can also be global and does not depend on any table and naturally, these are called unbound action.

Both actions and functions are considered to be full-scale SDK message. Meaning you can register a plugin at various stages of action.

More details can be found here,

Top comments (0)

🌚 Life is too short to browse without dark mode