Skip to content

Commit a0e265b

Browse files
authored
Merge pull request #3361 from MicrosoftDocs/master-jdaly-tag-documentation
content about tags
2 parents f2b707f + 6ebec4e commit a0e265b

File tree

3 files changed

+67
-10
lines changed

3 files changed

+67
-10
lines changed

powerapps-docs/developer/common-data-service/org-service/use-messages.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: "Use messages with the Organization service (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Understand how messages are used to invoke operations using the organization service." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
5-
ms.date: 10/31/2018
5+
ms.date: 09/08/2020
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
99
author: "JimDaly" # GitHub ID
10-
ms.author: "jdaly" # MSFT alias of Microsoft employees only
11-
manager: "ryjones" # MSFT alias of manager or PM counterpart
10+
ms.author: "pehecke" # MSFT alias of Microsoft employees only
11+
manager: "sunilg" # MSFT alias of manager or PM counterpart
1212
search.audienceType:
1313
- developer
1414
search.app:
@@ -100,6 +100,32 @@ req["SuppressDuplicateDetection"] = true;
100100
CreateResponse response = (CreateResponse)svc.Execute(req);
101101
```
102102

103+
### Add a Shared Variable from the Organization Service
104+
105+
You can set a string value that will be available to plug-ins within the ExecutionContext in the `SharedVariables` collection. More information: [Shared variables](../understand-the-data-context.md#shared-variables)
106+
107+
```csharp
108+
var account = new Entity("account");
109+
account["name"] = "Contoso";
110+
111+
var request = new CreateRequest() { Target = account };
112+
request["tag"] = "This is a value passed.";
113+
114+
var response = (CreateResponse)svc.Execute(request);
115+
```
116+
117+
118+
Will result in the following value within the `SharedVariables` collection when sent using a webhook.
119+
120+
```json
121+
{
122+
"key": "tag",
123+
"value": "This is a value passed."
124+
}
125+
```
126+
127+
This can also be done using the Web API: [Add a Shared Variable from the Web API](../webapi/compose-http-requests-handle-errors.md#add-a-shared-variable-from-the-web-api)
128+
103129
### See also
104130

105131
[Entity Operations using the Organization service](entity-operations.md)<br />

powerapps-docs/developer/common-data-service/understand-the-data-context.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: "Understand the execution context (Common Data Service) | Microsoft Docs"
33
description: "Learn about the data that is passed to your plug-ins when it is executed."
44
ms.custom: ""
5-
ms.date: 06/20/2019
5+
ms.date: 09/08/2020
66
ms.reviewer: pehecke
77
ms.service: powerapps
88
ms.topic: "article"
99
author: JimDaly
10-
ms.author: jdaly
11-
manager: ryjones
10+
ms.author: pehecke
11+
manager: sunilg
1212
search.audienceType:
1313
- developer
1414
search.app:
@@ -127,7 +127,7 @@ The `OutputParameters` are not populated until after the database transaction, s
127127

128128
## Shared variables
129129

130-
The <xref:Microsoft.Xrm.Sdk.IExecutionContext.SharedVariables> property allows for including data that can be passed from a plug-in to a step that occurs later in the execution pipeline. Because this is a <xref:Microsoft.Xrm.Sdk.ParameterCollection> value, plug-ins can add, read, or modify properties to share data with subsequent steps.
130+
The <xref:Microsoft.Xrm.Sdk.IExecutionContext.SharedVariables> property allows for including data that can be passed from the API or a plug-in to a step that occurs later in the execution pipeline. Because this is a <xref:Microsoft.Xrm.Sdk.ParameterCollection> value, plug-ins can add, read, or modify properties to share data with subsequent steps.
131131

132132
The following example shows how a `PrimaryContact` value can be passed from a plug-in registered for a **PreOperation** step to a **PostOperation** step.
133133

@@ -178,6 +178,19 @@ public class PostOperation : IPlugin
178178
> [!NOTE]
179179
> For a plug-in registered for the **PreOperation** or **PostOperation** stages to access the shared variables from a plug-in registered for the **PreValidation** stage that executes on **Create**, **Update**, **Delete**, or by a <xref:Microsoft.Crm.Sdk.Messages.RetrieveExchangeRateRequest>, you must access the <xref:Microsoft.Xrm.Sdk.IPluginExecutionContext.ParentContext>.**SharedVariables** collection. For all other cases, <xref:Microsoft.Xrm.Sdk.IPluginExecutionContext>.**SharedVariables** contains the collection.
180180

181+
### Passing a Shared Variable from the API
182+
183+
If you need to introduce a shared variable when you call an API, use the keyword `tag` from either the Web API or the Organization service to pass a string value.
184+
185+
This value will be accessible in the Shared Variable collection using the `tag` key. Once set, this value cannot be changed, it is immutable.
186+
187+
For information about how to set this see the following topics:
188+
189+
- [Add a Shared Variable from the Web API](webapi/compose-http-requests-handle-errors.md#add-a-shared-variable-from-the-web-api)
190+
- [Add a Shared Variable from the Organization Service](org-service/use-messages.md#add-a-shared-variable-from-the-organization-service)
191+
192+
193+
181194
## Entity Images
182195

183196
When you register a step for a plug-in that includes an entity as one of the parameters, you have the option to specify that a copy of the entity data be included as *snapshot* or image using the <xref:Microsoft.Xrm.Sdk.IExecutionContext.PreEntityImages> and/or <xref:Microsoft.Xrm.Sdk.IExecutionContext.PostEntityImages> properties.

powerapps-docs/developer/common-data-service/webapi/compose-http-requests-handle-errors.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Compose HTTP requests and handle errors (Common Data Service)| Microsoft Docs"
33
description: "Read about the HTTP methods and headers that form a part of HTTP requests that interact with the Web API and how to identify and handle errors returned in the response"
44
ms.custom: ""
5-
ms.date: 08/09/2020
5+
ms.date: 09/08/2020
66
ms.service: powerapps
77
ms.suite: ""
88
ms.tgt_pltfrm: ""
@@ -12,9 +12,9 @@ applies_to:
1212
ms.assetid: 64a39182-25de-4d31-951c-852025a75811
1313
caps.latest.revision: 13
1414
author: "JimDaly" # GitHub ID
15-
ms.author: "jdaly"
15+
ms.author: "pehecke"
1616
ms.reviewer: "pehecke"
17-
manager: "annbe"
17+
manager: "sunilg"
1818
search.audienceType:
1919
- developer
2020
search.app:
@@ -261,6 +261,24 @@ This response includes the following annotations:
261261
If you do not want to receive all annotations in the response, you can specify which specific annotations you want to have returned. Rather than using `Prefer: odata.include-annotations="*"`, you can use the following to receive only formatted values for operations that retrieve data and the helplink if an error occurs:
262262
`Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue,Microsoft.PowerApps.CDS.HelpLink"`.
263263

264+
## Add a Shared Variable from the Web API
265+
266+
You can set a string value that will be available to plug-ins within the ExecutionContext in the `SharedVariables` collection. More information: [Shared variables](../understand-the-data-context.md#shared-variables)
267+
268+
To pass this value using the Web API, simply use the `tag` query option.
269+
270+
For example: `?tag=This is a value passed.`
271+
272+
Will result in the following value within the `SharedVariables` collection when sent using a webhook.
273+
274+
```json
275+
{
276+
"key": "tag",
277+
"value": "This is a value passed."
278+
}
279+
```
280+
This can also be done using the Organization Service: [Add a Shared Variable from the Organization Service](../org-service/use-messages.md#add-a-shared-variable-from-the-organization-service)
281+
264282
### See also
265283

266284
[Perform operations using the Web API](perform-operations-web-api.md)<br />

0 commit comments

Comments
 (0)