web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

(0) ShareShare
ReportReport
Posted on by 12

I want to use  Xrm.WebApi.online.execute to execute a process Action which in turn executes a workflow activity plugin (codeactivity). 

1. Execute a process (workflow) Action (non-entity bound, eg. global).

pastedimage1659998267368v2.png

2. The Process action then calls a workflow activity plugin (CodeActivity) (with input parameters and output parameters).

pastedimage1659998436894v3.png

So according to the image below, I should be using ACTION operation type.

 pastedimage1659997788830v1.png

The question is 'what is FUNCTION" operation type?

How do you create a FUNCTION in Dynamics 365?

Is FUNCTION the same as plugin workflow activity? (ie CodeActivity)

pastedimage1659998718650v4.png

Thx

a2z

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You should install Dataverse rest builder tool to auto generate code to call your action

    carldesouza.com/.../

  • cheezecake Profile Picture
    12 on at

    Err.... so not a single one in this forum has used a FUNCTION Operation Type? I find that hard to believe.

    Can anyone from Microsoft answer my questions please?

    a2z

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    Hi cheezecake 

    Functions are similar to actions, except they are executed via HTTP GET rather than POST. As I suspect you've seen already, an example of Function provided by the platform is WhoAmI 

    You can create your own functions using the Custom API feature. The function accepts the parameters on the query string rather than via the POST body - but is passed to the plugin that implements the logic in the same way as an action. You can create a bound and unbound function, however there are some restrictions on the data types that functions can accept.

    Functions are somewhat easier to test since you can simply send the request in the browser, but if you are using the Xrm.Web.execute API, then it's all handled internally and doesn't really make must difference.

    So to answer your original question 'Is FUNCTION the same as plugin workflow activity? (ie CodeActivity)' - no they are not - they are created using the Custom API feature!


    Hope this helps!

    Scott

  • cheezecake Profile Picture
    12 on at

    That doesn't answer my questions. Thanks, but I have no need to use a Rest builder. I need to know what is FUNCTION operation type is in Dynamics 365. Can anyone give me an example of a D365 Function?

  • Ray Profile Picture
    1,537 on at

    Hi,

    You can check this link.

    A function is an operation which does not have observable side effects. They typically retrieve data. They may have parameters and they may return values. Functions may be bound to entity types.

    You can create your own function by create Custom API as Scott said.

  • Guido Preite Profile Picture
    54,086 Moderator on at

    Other already replied but

    1. A Function is not the same as the Code Activity
    2. the parameter operationType set to 1 for Xrm.WebApi calls is required when calling internal Functions (they already posted the link but is this one) or Custom APIs defined as Functions, for the other scenarios (Action, Custom Action, Custom API not defined as Function) the operationType is set to 0
    3. You can't create internal Functions, you can only create Custom API defined as Function

    I understand that you don't want to use my tool Dataverse REST Builder but (as this post can be beneficial to others) the tool has a request type "Execute Function" to deal with the internal functions and the request type "Execute Custom API" indicates if the Custom API is a function or not. The code generated set operationType to 1 for Xrm.WebApi calls.

    You can also check the online demo from here, the demo includes some internal Functions and a Custom API defined as Function, so you can see how the generated Xrm.WebApi code looks like, without installing the tool.

    as last thing, the page where you took the screenshot where the operationType values are written, contains an example on how a function is called, this link.

    hope it helps

  • cheezecake Profile Picture
    12 on at

    Now this is the sort of answers I am looking for. And yes, I have managed to use configure and use Custom API and also called a Workflow Activity via an Action. Thank you Scott!

    a2z

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans