You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/webapi/use-web-api-actions.md
+66-7Lines changed: 66 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Use Web API actions (Microsoft Dataverse)| Microsoft Docs"
3
3
descriptions: "Actions are reusable operations that can be performed using the Web API. These are used with a POST request to modify data on Microsoft Dataverse"
4
4
ms.custom: ""
5
-
ms.date: 10/31/2018
5
+
ms.date: 11/21/2020
6
6
ms.service: powerapps
7
7
ms.suite: ""
8
8
ms.tgt_pltfrm: ""
@@ -78,7 +78,15 @@ OData-Version: 4.0
78
78
79
79
## Bound actions
80
80
81
-
In the [CSDL metadata document](web-api-types-operations.md#bkmk_csdl), when an `Action` element represents a bound action, it has an `IsBound` attribute with the value `true`. The first `Parameter` element defined within the action represents the entity that the operation is bound to. When the `Type` attribute of the parameter is a collection, the operation is bound to a collection of entities. As an example, the following is the definition of the <xrefhref="Microsoft.Dynamics.CRM.AddToQueue?text=AddToQueue Action" /> represented in the CSDL:
81
+
There are two ways that an action can be bound. The most common way is for the action to be bound by an entity. Less frequently, it can also be bound to an entity collection.
82
+
83
+
In the [CSDL metadata document](web-api-types-operations.md#bkmk_csdl), when an `Action` element represents a bound action, it has an `IsBound` attribute with the value `true`. The first `Parameter` element defined within the action represents the entity that the operation is bound to. When the `Type` attribute of the parameter is a collection, the operation is bound to a collection of entities.
84
+
85
+
When invoking a bound function, you must include the full name of the function including the `Microsoft.Dynamics.CRM` namespace. If you do not include the full name, you will get the following error: `Status Code:400 Request message has unresolved parameters`.
86
+
87
+
### Actions bound to an entity
88
+
89
+
As an example of an action bound to an entity, the following is the definition of the <xrefhref="Microsoft.Dynamics.CRM.AddToQueue?text=AddToQueue Action" /> represented in the CSDL:
82
90
83
91
```xml
84
92
<ComplexTypeName="AddToQueueResponse">
@@ -93,13 +101,11 @@ In the [CSDL metadata document](web-api-types-operations.md#bkmk_csdl), when an
93
101
</Action>
94
102
```
95
103
96
-
This bound action is equivalent to the <xref:Microsoft.Crm.Sdk.Messages.AddToQueueRequest> used by the organization service. In the Web API this action is bound to the <xrefhref="Microsoft.Dynamics.CRM.queue?text=queue EntityType" />) that represents the <xref:Microsoft.Crm.Sdk.Messages.AddToQueueRequest>.<xref:Microsoft.Crm.Sdk.Messages.AddToQueueRequest.DestinationQueueId> property. This action accepts several additional parameters and returns a <xrefhref="Microsoft.Dynamics.CRM.AddToQueueResponse?text=AddToQueueResponse ComplexType" /> corresponding to the <xref:Microsoft.Crm.Sdk.Messages.AddToQueueResponse> returned by the organization service. When an action returns a complex type, the definition of the complex type will appear directly above the action in the CSDL.
97
-
98
-
A bound action must be invoked using a URI to set the first parameter value. You cannot set it as a named parameter value.
104
+
This entity bound action is equivalent to the <xref:Microsoft.Crm.Sdk.Messages.AddToQueueRequest> used by the organization service. In the Web API this action is bound to the <xrefhref="Microsoft.Dynamics.CRM.queue?text=queue EntityType" /> that represents the <xref:Microsoft.Crm.Sdk.Messages.AddToQueueRequest>.<xref:Microsoft.Crm.Sdk.Messages.AddToQueueRequest.DestinationQueueId> property. This action accepts several additional parameters and returns a <xrefhref="Microsoft.Dynamics.CRM.AddToQueueResponse?text=AddToQueueResponse ComplexType" /> corresponding to the <xref:Microsoft.Crm.Sdk.Messages.AddToQueueResponse> returned by the organization service. When an action returns a complex type, the definition of the complex type will appear directly above the action in the CSDL.
99
105
100
-
When invoking a bound function, you must include the full name of the function including the `Microsoft.Dynamics.CRM` namespace. If you do not include the full name, you will get the following error: Status Code:400 Request message has unresolved parameters.
106
+
An action bound to an entity must be invoked using a URI to set the first parameter value. You cannot set it as a named parameter value.
101
107
102
-
The following example shows using the <xrefhref="Microsoft.Dynamics.CRM.AddToQueue?text=AddToQueue Action" /> to add a letter to a queue. Because the type of the `Target` parameter type is not specific (`mscrm.crmbaseentity`), you must explicitly declare type of the object using the `@odata.type` property value of the full name of the entity, including the `Microsoft.Dynamics.CRM` namespace. In this case, `Microsoft.Dynamics.CRM.letter`. More information:[Specify entity parameter type](#bkmk_specifyentityparametertype)
108
+
The following example shows using the <xrefhref="Microsoft.Dynamics.CRM.AddToQueue?text=AddToQueue Action" /> to add a letter to a queue. Because the type of the `Target` parameter type is not specific (`mscrm.crmbaseentity`), you must explicitly declare type of the object using the `@odata.type` property value of the full name of the entity, including the `Microsoft.Dynamics.CRM` namespace. In this case, `Microsoft.Dynamics.CRM.letter`. More information:[Specify entity parameter type](#bkmk_specifyentityparametertype)
103
109
104
110
**Request**
105
111
@@ -132,6 +138,59 @@ OData-Version: 4.0
132
138
}
133
139
```
134
140
141
+
### Actions bound to an entity collection
142
+
143
+
It is less common to find actions bound to an entity collection. The following are some you may find:
As an example of an action bound to an entity collection, the following is the definition of the <xrefhref="Microsoft.Dynamics.CRM.ExportTranslation?text=ExportTranslation Action" /> represented in the CSDL:
This entity collection bound action is equivalent to the <xref:Microsoft.Crm.Sdk.Messages.ExportTranslationRequest> used by the organization service. In the Web API this action is bound to the <xrefhref="Microsoft.Dynamics.CRM.solution?text=solution EntityType" />. But rather than passing a value to the request, the entity collection binding simply applies the constraint that the URI of the request must include the path to the specified entity set.
164
+
165
+
The following example shows using the <xrefhref="Microsoft.Dynamics.CRM.ExportTranslation?text=ExportTranslation Action" /> which exports a binary file containing data about localizable string values which can be updated to modify or add localizable values. Note how the entity collection bound action is preceded by the entity set name for the solution entity: `solutions`.
166
+
167
+
**Request**
168
+
169
+
```http
170
+
POST [Organization URI]/api/data/v9.1/solutions/Microsoft.Dynamics.CRM.ExportTranslation HTTP/1.1
0 commit comments