Sample: Create a basic plug-in
This sample shows how to write a simple plug-in that creates a follow-up activity. You can download the sample from here.
How to run this sample
- Download or clone the Samples repo so that you have a local copy. This sample is located under PowerApps-Samples-master\cds\orgsvc\C#\FollowupPlugin.
- Open the sample solution in Visual Studio, navigate to the project's properties, and verify the assembly will be signed during the build. Press F6 to build the sample's assembly (FollowupPlugin.dll).
- Run the Plug-in Registration tool and register the sample's assembly in the D365 server's sandbox and database. When registering a step, specify the Create message, account entity, and asynchronous mode.
- Using the D365 app, perform the appropriate operation to invoke the message and entity request that you registered the plug-in on (create an account).
- After the plug-in runs, you should see a new trace log entry "FollowupPlugin: Successfully created the task activity" and a new activity with the subject "Send e-mail to the new customer." that is scheduled to activate in 7 days.
- When you are done testing, unregister the assembly and step.
What this sample does
When executed upon creation of an account, the plug-in creates an activity to remind the user to follow-up with the account customer in 7 days.
How this sample works
In order to simulate the scenario described in What this sample does, the sample will do the following:
- How to create a task activity and schedule it for a future date.
- How to use the tracing service to log run-time information.
- How to catch exceptions from the web service and process it.