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/data-platform/register-plug-in.md
+35-88Lines changed: 35 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Register a plug-in (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
-
description: "Learn how to register a plug-in in a step of the Microsoft Dataverse event pipeline."# 115-145 characters including spaces. This abstract displays in the search result.
4
-
ms.date: 04/07/2023
3
+
description: "Learn how to register a plug-in assembly and step with the Microsoft Dataverse event framework pipeline."# 115-145 characters including spaces. This abstract displays in the search result.
4
+
ms.date: 06/22/2023
5
5
ms.reviewer: "pehecke"
6
6
ms.topic: "article"
7
7
author: "divkamath"# GitHub ID
@@ -10,45 +10,25 @@ ms.author: "jdaly" # MSFT alias of Microsoft employees only
You can use Power Platform Tools for Visual Studio to quickly create and deploy (register) plug-ins. A [quickstart](tools/devtools-create-plugin.md) article is available to show you how.
21
+
After a plug-in is written and compiled, it must be registered with the event framework to execute when a specific entity type (table) and operation (message) is processed by Dataverse. To register a plug-in with the Dataverse event framework requires use of a tool - Plug-in Registration tool (PRT), or the Power Platform Tools extension for Visual Studio.
22
22
23
-
A more manual process of writing, registering, and debugging a plug-in is:
23
+
The PRT specializes in object registrations and editing those registrations. This article describes how to register a plug-in assembly and step using the Plug-in Registration tool.
24
24
25
-
1. Create a .NET Framework class library project in Visual Studio
26
-
1. Add the `Microsoft.CrmSdk.CoreAssemblies` NuGet package to the project
27
-
1. Implement the <xref:Microsoft.Xrm.Sdk.IPlugin> interface on classes to be registered on plug-in steps.
28
-
1. Add your code to the <xref:Microsoft.Xrm.Sdk.IPlugin.Execute*> method required by the interface
29
-
1. Get references to services you need
30
-
1. Add your custom business logic
31
-
1. Sign & build the assembly
32
-
1. Test the assembly
33
-
1. Register the assembly in a test environment
34
-
1. Add your registered assembly and steps to an unmanaged solution
35
-
1. Test the behavior of the assembly
36
-
1. Verify expected trace logs are written
37
-
1. Debug the assembly as needed
25
+
The Visual Studio extension provides a more feature rich development environment and covers the entire coding, deployment, and debugging/profiling flow. For information about using the Power Platform Tools extension for Visual Studio see [quickstart](tools/devtools-create-plugin.md).
38
26
39
-
This topic describes how to register a plug-in assembly and step, and add them to a solution. Additional information can be found in these tutorials:
27
+
## Plug-in Registration tool
40
28
41
-
-[Tutorial: Write and register a plug-in](tutorial-write-plug-in.md)
42
-
-[Tutorial: Debug a plug-in](tutorial-debug-plug-in.md)
43
-
-[Tutorial: Update a plug-in](tutorial-update-plug-in.md)
29
+
The Plug-in Registration tool (PRT) enables you to register your plug-in assemblies, and other types of objects, with Dataverse. PRT is one of several Dataverse tools available for download from NuGet.org. Follow the instructions in [Dataverse development tools](download-tools-nuget.md) to download PRT and optionally other development tools.
44
30
45
-
## Plug-in Registration tool (PRT)
46
-
47
-
You use the Plug-in Registration tool (PRT) to register your plug-in assemblies and steps.
48
-
49
-
PRT is one of the tools available for download from NuGet. Follow the instructions in [Dataverse development tools](download-tools-nuget.md). That topic includes Power Platform CLI instructions to download PRT and other development tools from NuGet.
50
-
51
-
After you download the PRT, use the [Connect using the Plug-in Registration tool](tutorial-write-plug-in.md#connect-using-the-plug-in-registration-tool) steps in the [Tutorial: Write and register a plug-in](tutorial-write-plug-in.md) to connect to your Microsoft Dataverse environment.
31
+
After you download the PRT, follow the [Connect using the Plug-in Registration tool](tutorial-write-plug-in.md#connect-using-the-plug-in-registration-tool) instructions to connect the tool to your target Dataverse environment where your plug-in is to be registered.
52
32
53
33
## Register an assembly
54
34
@@ -76,55 +56,6 @@ After selecting the name of the Default Solution in the internal solution list,
76
56
77
57

78
58
79
-
### Query registered assemblies with code
80
-
81
-
To view information about registered assemblies without the PRT or the application, use the following Web API query in your browser:
82
-
83
-
```
84
-
[org uri]]/api/data/v9.0/pluginassemblies
85
-
?$filter=ishidden/Value eq false
86
-
&$select=
87
-
createdon,
88
-
culture,
89
-
customizationlevel,
90
-
description,
91
-
isolationmode,
92
-
major,
93
-
minor,
94
-
modifiedon,
95
-
name,
96
-
pluginassemblyid,
97
-
publickeytoken,
98
-
version
99
-
```
100
-
101
-
Or use following FetchXml to retrieve it in a program you write:
More information: [Use FetchXML with FetchExpression](org-service/entity-operations-query-data.md#use-fetchxml-with-fetchexpression)
127
-
128
59
## Add your assembly to a solution
129
60
130
61
As described in [View registered assemblies](#view-registered-assemblies), the assembly registration you created was added to the system **Default Solution**. You should add your assembly to an unmanaged solution so you can distribute it to other organizations.
@@ -238,7 +169,6 @@ In Dataverse, only the following messages support entity images:
238
169
|`SetState`|`EntityMoniker`|The table for which the state is set.|
239
170
|`Update`|`Target`|The updated table.|
240
171
241
-
242
172
#### Types of entity images
243
173
244
174
There are two types of entity images: **Pre Image** and **Post Image**. When you configure them, these images will be available within the execution context as <xref:Microsoft.Xrm.Sdk.IExecutionContext.PreEntityImages> and <xref:Microsoft.Xrm.Sdk.IExecutionContext.PostEntityImages> properties respectively. As the names suggest, these snapshots represent what the table looks like before the operation and after the operation. When you configure an entity image, you'll define a table alias* value that will be the key value you'll use to access a specific entity image from the `PreEntityImages` or `PostEntityImages` properties.
@@ -252,7 +182,6 @@ When you configure an entity image, it's important that you recognize that the t
252
182
- You can only have a **Post Image** for steps registered in the **PostOperation** stage of the execution pipeline because there's no way to know what the table properties will be until the transaction is completed.
253
183
- For an `Update` operation that is registered in the **PostOperation** stage you can have both a **Pre Image** AND a **Post Image**.
254
184
255
-
256
185
#### Add an entity image
257
186
258
187
Use the [Power Platform Tools](tools/devtools-install.md) extension for Visual Studio to [add an entity image](tools/devtools-create-plugin.md#add-an-entity-image) to a plug-in step.
@@ -289,7 +218,6 @@ Plug-in assemblies can be versioned using a semantic versioning format of `major
289
218
290
219
When an updated solution containing the revised assembly is imported, the assembly is considered a different assembly than the previous version of that assembly in the existing solution. Plug-in registration steps in the existing solution will continue to refer to the previous version of the assembly. If you want existing plug-in registration steps for the previous assembly to point to the revised assembly, you'll need to use the Plug-in Registration tool to manually change the step configuration to refer to the revised assembly type. This should be done before exporting the updated assembly into a solution for later import.
291
220
292
-
293
221
## Unregister or disable plug-ins and components
294
222
295
223
You can unregister or disable plug-ins and their components using the Plug-in Registration tool (PRT).
@@ -310,28 +238,47 @@ You can also delete **Plug-in Assemblies** and **Sdk Message Processing Steps**
310
238
> [!NOTE]
311
239
> You cannot delete (unregister) any **Plug-in Assemblies** while existing **Sdk Message Processing Steps** depend on them. Entity images are not available to be deleted separately, but they will be deleted when any steps that use them are deleted.
312
240
313
-
### Disable steps
241
+
### Disable or enable a plug-in step
242
+
243
+
With the Plug-in Registration tool running and logged into the target Dataverse environment, you can proceed to disable or enable plug-in steps. Disabling a step effectively turns off the plug-in from executing when Dataverse processes the entity and message combination specified in the step registration.
314
244
315
-
The PRT provides commands to disable and enable steps.
245
+
To disable or enable a registered plug-in step:
316
246
317
-

247
+
1. Expand the target plug-in assembly node in the assembly view until you see the desired step registration node.
248
+
1. Choose the step, and then choose **Enable** or **Disable** in either the context menu or the toolbar.
318
249
319
-

250
+
|Disable a plug-in step|Enable a plug-in step|
251
+
|--|---|
252
+
|:::image type="content" source="media/enable-step-prt.png" alt-text="Disable a step using the Plug-in Registration tool.":::
253
+
|:::image type="content" source="media/enable-step-prt.png" alt-text="Enable a step using the Plug-in Registration tool.":::|
320
254
321
-
You can also disable steps in the solution explorer using the **Activate** and **Deactivate**commands.
255
+
You can also disable or enable steps in the legacy Dataverse Solution Explorer user interface using the **Activate** and **Deactivate**command options.

258
+
259
+
### Change user impersonation for a step
260
+
261
+
With the Plug-in Registration tool running and logged into the target Dataverse environment, you can proceed to make changes to an existing step registration. In this section, we will discuss changing the user on whos behalf the plug-in will perform its operations. Meaning, the effective user that is performing the data operations initiated by the plug-in. By default, the calling user (the user that invoked an operation in Dataverse) is the owner of said operations. However a different user can be specified in the step registration. You will need to have the System Administrator or System Customizer role to perform this operation.
262
+
263
+
To change the user in a registered plug-in step:
264
+
265
+
1. Expand the target plug-in assembly node in the assembly view until you see the desired (Step) registration node.
266
+
1. Select the step, and then select **Update** in either the context menu or the toolbar.
267
+
1. Choose a different user from the drop-down list of available users next to the **Run in User's Context** label.
268
+
1. Choose **Update Step**.
269
+
270
+
More information: [Impersonate a user](impersonate-a-user.md)
324
271
325
272
## Next steps
326
273
327
274
[Debug Plug-ins](debug-plug-in.md)
328
275
329
276
### See also
277
+
330
278
[Write plug-ins to extend business processes](plug-ins.md)<br />
331
279
[Write a plug-in](write-plug-in.md)<br />
332
280
[Tutorial: Write and register a plug-in](tutorial-write-plug-in.md)<br />
333
281
[Tutorial: Debug a plug-in](tutorial-debug-plug-in.md)<br />
334
282
[Tutorial: Update a plug-in](tutorial-update-plug-in.md)<br />
0 commit comments