Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Answered

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

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

  • cheezecake Profile Picture
    cheezecake 12 on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    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

  • Guido Preite Profile Picture
    Guido Preite 54,065 Moderator on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    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

  • Ray Profile Picture
    Ray 1,479 on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    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.

  • cheezecake Profile Picture
    cheezecake 12 on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    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?

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 50,170 on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    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
    cheezecake 12 on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    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
    Bipin D365 Profile Picture
    Bipin D365 28,962 Moderator on at
    RE: What is a FUNCTION operation type in request body of Xrm.WebApi.online.execute

    Hi,

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

    carldesouza.com/.../

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans