DEV Community

Imran
Imran

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.

Function

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

Action

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,

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay