Skip to content

Commit a6b68f6

Browse files
committed
Added step impersonation
Plus other updates to text and images
1 parent 2a3b484 commit a6b68f6

File tree

4 files changed

+35
-88
lines changed

4 files changed

+35
-88
lines changed
322 KB
Loading
321 KB
Loading
149 KB
Loading

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

Lines changed: 35 additions & 88 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,25 @@ 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 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.
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 flow. For information about using the Power Platform Tools extension for Visual Studio see [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+
## Plug-in Registration tool
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+
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.
4430

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.
5232

5333
## Register an assembly
5434

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

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

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-
12859
## Add your assembly to a solution
12960

13061
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:
238169
|`SetState`|`EntityMoniker`|The table for which the state is set.|
239170
|`Update`|`Target`|The updated table.|
240171

241-
242172
#### Types of entity images
243173

244174
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
252182
- 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.
253183
- For an `Update` operation that is registered in the **PostOperation** stage you can have both a **Pre Image** AND a **Post Image**.
254184

255-
256185
#### Add an entity image
257186

258187
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
289218

290219
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.
291220

292-
293221
## Unregister or disable plug-ins and components
294222

295223
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**
310238
> [!NOTE]
311239
> 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.
312240
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.
314244

315-
The PRT provides commands to disable and enable steps.
245+
To disable or enable a registered plug-in step:
316246

317-
![disable a step using the PRT.](media/disable-step-prt.png)
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.
318249

319-
![enable a step using the PRT.](media/enable-step-prt.png)
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.":::|
320254

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.
322256

323-
![foo.](media/step-activate-deactivate-commands-solution-explorer.png)
257+
![Changing a plug-in step in legacy Solution Explorer.](media/step-activate-deactivate-commands-solution-explorer.png)
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)
324271

325272
## Next steps
326273

327274
[Debug Plug-ins](debug-plug-in.md)
328275

329276
### See also
277+
330278
[Write plug-ins to extend business processes](plug-ins.md)<br />
331279
[Write a plug-in](write-plug-in.md)<br />
332280
[Tutorial: Write and register a plug-in](tutorial-write-plug-in.md)<br />
333281
[Tutorial: Debug a plug-in](tutorial-debug-plug-in.md)<br />
334282
[Tutorial: Update a plug-in](tutorial-update-plug-in.md)<br />
335283

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

0 commit comments

Comments
 (0)