Skip to content

Commit 688d3d2

Browse files
authored
Merge pull request #8379 from MicrosoftDocs/phecke-plugin-updates
Plugin content updates
2 parents 928c2ec + 6a54e16 commit 688d3d2

File tree

4 files changed

+44
-93
lines changed

4 files changed

+44
-93
lines changed
Loading
Loading
Binary file not shown.

powerapps-docs/developer/data-platform/register-plug-in.md

Lines changed: 44 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
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
55
ms.reviewer: "pehecke"
66
ms.topic: "article"
77
author: "divkamath" # GitHub ID
@@ -10,45 +10,29 @@ ms.author: "jdaly" # MSFT alias of Microsoft employees only
1010
search.audienceType:
1111
- developer
1212
contributors:
13-
- PHecke
13+
- phecke
1414
- ProfessorKendrick
1515
---
1616

1717
# Register a plug-in
1818

1919
[!INCLUDE[cc-terminology](includes/cc-terminology.md)]
2020

21-
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.
2222

23-
A more manual process of writing, registering, and debugging a plug-in is:
23+
The PRT creates Dataverse object registrations and supports editing those registrations. This article describes how to register a plug-in assembly and step, add an assembly to a solution, and perform other common operations using the Plug-in Registration tool.
2424

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 development process. For information about using the Power Platform Tools extension for Visual Studio, see the [quickstart](tools/devtools-create-plugin.md).
3826

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+
More information: [Event framework](event-framework.md)
4028

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+
## About the Plug-in Registration tool
4430

45-
## Plug-in Registration tool (PRT)
31+
The Plug-in Registration tool (PRT) supports registration of plug-in assemblies, message processing steps, and other types of objects with Dataverse. PRT is one of several Dataverse tools available for download from [NuGet.org](https://www.nuget.org). Follow the instructions in [Dataverse development tools](download-tools-nuget.md) to download PRT and optionally other development tools.
4632

47-
You use the Plug-in Registration tool (PRT) to register your plug-in assemblies and steps.
33+
After you download the PRT, follow the [Connect using the Plug-in Registration tool](tutorial-write-plug-in.md#register-plug-in) instructions to connect the tool to your target Dataverse environment where your plug-in is to be registered.
4834

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.
35+
:::image type="content" source="media/dv_plugin_registration_tool.png" alt-text="The Plug-in Registration tool main window.":::
5236

5337
## Register an assembly
5438

@@ -76,55 +60,6 @@ After selecting the name of the Default Solution in the internal solution list,
7660

7761
![View all registered assemblies.](media/view-plug-in-assemblies-default-solution.png)
7862

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:
102-
103-
```xml
104-
<fetch>
105-
<entity name='pluginassembly' >
106-
<attribute name='createdon' />
107-
<attribute name='culture' />
108-
<attribute name='customizationlevel' />
109-
<attribute name='description' />
110-
<attribute name='isolationmode' />
111-
<attribute name='major' />
112-
<attribute name='minor' />
113-
<attribute name='modifiedon' />
114-
<attribute name='name' />
115-
<attribute name='pluginassemblyid' />
116-
<attribute name='publickeytoken' />
117-
<attribute name='version' />
118-
<filter type='and' >
119-
<filter>
120-
<condition attribute='ishidden' operator='eq' value='false' />
121-
</filter>
122-
</filter>
123-
</entity>
124-
</fetch>
125-
```
126-
More information: [Use FetchXML with FetchExpression](org-service/entity-operations-query-data.md#use-fetchxml-with-fetchexpression)
127-
12863
## Add your assembly to a solution
12964

13065
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.
@@ -160,7 +95,7 @@ When you register a step, there are several registration options available to yo
16095
|**Filtering Attributes**|With the `Update` or `OnExternalUpdated` message, when you set the **Primary Entity**, filtering columns limits the execution of the plug-in to cases where the selected columns are included in the update. Setting this field is a best practice for performance. |
16196
|**Event Handler**|This field value will be populated based on the name of the assembly and the plug-in class. |
16297
|**Step Name**|The name of the step. A value is pre-populated based on the configuration of the step, but this value can be overridden.|
163-
|**Run in User's Context**|Provides options for applying impersonation for the step. The default value is **Calling User**. If the calling user doesn't have privileges to perform operations in the step, you may need to set this field value to a user who has these privileges. More information: [Impersonate a user](impersonate-a-user.md) |
98+
|**Run in User's Context**|Provides options for applying impersonation for the step. The default value is **Calling User**. If the calling user doesn't have privileges to perform operations in the step, you may need to set this field value to a user who has these privileges. More information: [Set user impersonation for a step](#set-user-impersonation-for-a-step) |
16499
|**Execution Order**|Multiple steps can be registered for the same stage of the same message. The number in this field determines the order in which they'll be applied from lowest to highest. <br/> **Note**: You should set this to control the order in which plug-ins are applied in the stage. It's not recommended to simply accept the default value. The actual execution order of the plugins with the same Execution Order value (for the same stage, table and message) isn't guaranteed and can be random.|
165100
|**Description**|A description for step. This value is pre-populated but can be overwritten.|
166101

@@ -238,7 +173,6 @@ In Dataverse, only the following messages support entity images:
238173
|`SetState`|`EntityMoniker`|The table for which the state is set.|
239174
|`Update`|`Target`|The updated table.|
240175

241-
242176
#### Types of entity images
243177

244178
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 +186,6 @@ When you configure an entity image, it's important that you recognize that the t
252186
- 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.
253187
- For an `Update` operation that is registered in the **PostOperation** stage you can have both a **Pre Image** AND a **Post Image**.
254188

255-
256189
#### Add an entity image
257190

258191
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.
@@ -271,6 +204,19 @@ If you encounter this, you should usually select **OK** to bring the assembly in
271204

272205
Similarly, you should note that removing the assembly from the solution won't remove any steps that depend on it.
273206

207+
### Set user impersonation for a step
208+
209+
With the Plug-in Registration tool running and logged into the target Dataverse environment, you can proceed to set or change a 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 security role to perform this operation.
210+
211+
To set the user in a plug-in step:
212+
213+
1. Expand the target plug-in assembly node in the assembly view until you see the desired (Step) registration node.
214+
1. Choose the step node, and then choose **Update** in either the context menu or the toolbar.
215+
1. Choose a different user from the drop-down list of available users next to the **Run in User's Context** label.
216+
1. Choose **Update Step**.
217+
218+
More information: [Impersonate a user](impersonate-a-user.md)
219+
274220
## Update an assembly
275221

276222
When you change and rebuild an assembly that you've previously registered, you'll need to update it. See the [Update the plug-in assembly registration](tutorial-update-plug-in.md#update-the-plug-in-assembly-registration) step in the [Tutorial: Update a plug-in](tutorial-update-plug-in.md) for the steps.
@@ -289,14 +235,31 @@ Plug-in assemblies can be versioned using a semantic versioning format of `major
289235

290236
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.
291237

292-
293238
## Unregister or disable plug-ins and components
294239

295240
You can unregister or disable plug-ins and their components using the Plug-in Registration tool (PRT).
296241

297242
> [!IMPORTANT]
298243
> It is no longer possible to unregister or disable Microsoft or out-of-box system plug-ins and steps. Previously, you were able to unregister or disable some of the Microsoft.* and other out-of-box system plug-ins. We have changed this behavior to no longer allow this. The change in functionality was made because unregistering or disabling these plug-ins or steps can cause product features not to work as expected. If you have a need to unregister or disable such a plug-in or step, file a Microsoft support request.
299244
245+
### Disable or enable a plug-in step
246+
247+
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.
248+
249+
> [!IMPORTANT]
250+
> Disabling a plug-in can negatively affect the functionality of your app, a solution, or the Dataverse system. Make sure you understand the implications before you proceed.
251+
252+
To disable or enable a registered plug-in step:
253+
254+
1. Expand the target plug-in assembly node in the assembly view until you see the desired step registration node.
255+
1. Choose the step, and then choose **Enable** or **Disable** in either the context menu or the toolbar.
256+
257+
:::image type="content" source="media/disable-step-prt.png" alt-text="Disable a step using the Plug-in Registration tool.":::
258+
259+
You can also disable or enable steps in the legacy Dataverse Solution Explorer user interface using the **Activate** and **Deactivate** command options.
260+
261+
:::image type="content" source="media/step-activate-deactivate-commands-solution-explorer.png" alt-text="Changing a plug-in step in legacy Solution Explorer.":::
262+
300263
### Unregister components
301264

302265
The PRT provides commands to unregister assemblies, types, steps, and images. See the [Unregister assembly, plug-in, and step](tutorial-update-plug-in.md#unregister-assembly-plug-in-and-step) instructions in the [Tutorial: Update a plug-in](tutorial-update-plug-in.md) for the procedure.
@@ -310,28 +273,16 @@ You can also delete **Plug-in Assemblies** and **Sdk Message Processing Steps**
310273
> [!NOTE]
311274
> 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.
312275
313-
### Disable steps
314-
315-
The PRT provides commands to disable and enable steps.
316-
317-
![disable a step using the PRT.](media/disable-step-prt.png)
318-
319-
![enable a step using the PRT.](media/enable-step-prt.png)
320-
321-
You can also disable steps in the solution explorer using the **Activate** and **Deactivate** commands.
322-
323-
![foo.](media/step-activate-deactivate-commands-solution-explorer.png)
324-
325276
## Next steps
326277

327278
[Debug Plug-ins](debug-plug-in.md)
328279

329280
### See also
281+
330282
[Write plug-ins to extend business processes](plug-ins.md)<br />
331283
[Write a plug-in](write-plug-in.md)<br />
332284
[Tutorial: Write and register a plug-in](tutorial-write-plug-in.md)<br />
333285
[Tutorial: Debug a plug-in](tutorial-debug-plug-in.md)<br />
334286
[Tutorial: Update a plug-in](tutorial-update-plug-in.md)<br />
335287

336-
337288
[!INCLUDE[footer-include](../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)