|
2 | 2 | title: "Understand the execution context (Common Data Service) | Microsoft Docs"
|
3 | 3 | description: "Learn about the data that is passed to your plug-ins when it is executed."
|
4 | 4 | ms.custom: ""
|
5 |
| -ms.date: 06/20/2019 |
| 5 | +ms.date: 09/08/2020 |
6 | 6 | ms.reviewer: pehecke
|
7 | 7 | ms.service: powerapps
|
8 | 8 | ms.topic: "article"
|
9 | 9 | author: JimDaly
|
10 |
| -ms.author: jdaly |
11 |
| -manager: ryjones |
| 10 | +ms.author: pehecke |
| 11 | +manager: sunilg |
12 | 12 | search.audienceType:
|
13 | 13 | - developer
|
14 | 14 | search.app:
|
@@ -127,7 +127,7 @@ The `OutputParameters` are not populated until after the database transaction, s
|
127 | 127 |
|
128 | 128 | ## Shared variables
|
129 | 129 |
|
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. |
131 | 131 |
|
132 | 132 | The following example shows how a `PrimaryContact` value can be passed from a plug-in registered for a **PreOperation** step to a **PostOperation** step.
|
133 | 133 |
|
@@ -178,6 +178,19 @@ public class PostOperation : IPlugin
|
178 | 178 | > [!NOTE]
|
179 | 179 | > 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.
|
180 | 180 |
|
| 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 | + |
181 | 194 | ## Entity Images
|
182 | 195 |
|
183 | 196 | 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.
|
|
0 commit comments