-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
347d072
commit 267640c
Showing
7 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("createAppointment")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("createAppointment")] | ||
[assembly: AssemblyCopyright("Copyright © 2021")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("82412731-6544-48b9-83e3-4ee8ea8bab2a")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
//dynamics 365 crm namespaces | ||
using Microsoft.Xrm.Sdk; | ||
using System.ServiceModel; | ||
|
||
namespace createAppointment | ||
{ | ||
public class createAppointement : IPlugin | ||
{ | ||
public void Execute(IServiceProvider serviceProvider) | ||
{ | ||
//code goes here | ||
// Obtains the tracing service, not using in this plugin as of now - JSB | ||
/* | ||
ITracingService tracingService = | ||
(ITracingService)serviceProvider.GetService(typeof(ITracingService)); */ | ||
|
||
// Obtain the execution context from the service provider. | ||
IPluginExecutionContext context = (IPluginExecutionContext) | ||
serviceProvider.GetService(typeof(IPluginExecutionContext)); | ||
|
||
// The InputParameters collection contains all the data passed in the message request. | ||
if (context.InputParameters.Contains("Target") && | ||
context.InputParameters["Target"] is Entity) | ||
{ | ||
// Obtain the target entity from the input parameters. | ||
Entity entity = (Entity)context.InputParameters["Target"]; | ||
|
||
if (entity.LogicalName != "account") // if record is created in account entity then | ||
return; | ||
try | ||
{ | ||
// Plug-in business logic goes here. | ||
// Create a task activity to follow up with the account customer in 6-7 days. | ||
Entity rendezvous = new Entity("appointment"); | ||
|
||
rendezvous["subject"] = "First Appointment with the customer."; | ||
rendezvous["description"] = "Check if there are any new issues that need resolution."; | ||
rendezvous["scheduledstart"] = DateTime.Now.AddDays(6); | ||
rendezvous["scheduledend"] = DateTime.Now.AddDays(7); | ||
rendezvous["category"] = context.PrimaryEntityName; | ||
|
||
// Refer to the account in the task activity. | ||
if (context.OutputParameters.Contains("id")) | ||
{ | ||
Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString()); | ||
string regardingobjectidType = "account"; // account entity is target for regarding field | ||
|
||
rendezvous["regardingobjectid"] = | ||
new EntityReference(regardingobjectidType, regardingobjectid); | ||
|
||
Guid requiredattendees = new Guid(context.OutputParameters["id"].ToString()); | ||
string requiredattendeesType = "account"; // account entity is target for regarding field | ||
|
||
rendezvous["requiredattendees"] = | ||
new EntityReference(requiredattendeesType, requiredattendees); | ||
|
||
} | ||
|
||
// Obtain the organization service reference which you will need for | ||
// web service calls. | ||
IOrganizationServiceFactory serviceFactory = | ||
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); | ||
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); | ||
|
||
// Create the task in Microsoft Dynamics CRM. | ||
// Not creating a tracing service in this plugin for debugbing | ||
/* | ||
tracingService.Trace("rendezvousPlugin: Creating the task activity."); | ||
*/ | ||
service.Create(rendezvous); | ||
} | ||
|
||
catch (FaultException<OrganizationServiceFault> ex) | ||
{ | ||
throw new InvalidPluginExecutionException("An error occurred in rendezvousPlugin.", ex); | ||
} | ||
|
||
catch (Exception ex) | ||
{ | ||
throw; | ||
// tracingService.Trace("rendezvousPlugin: {0}", ex.ToString()); | ||
} | ||
} | ||
else | ||
{ | ||
return; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{82412731-6544-48B9-83E3-4EE8EA8BAB2A}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>createAppointment</RootNamespace> | ||
<AssemblyName>createAppointment</AssemblyName> | ||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<SignAssembly>true</SignAssembly> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AssemblyOriginatorKeyFile>test.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.Crm.Sdk.Proxy, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.9.0.2.42\lib\net462\Microsoft.Crm.Sdk.Proxy.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.9.0.2.42\lib\net462\Microsoft.Xrm.Sdk.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.DirectoryServices" /> | ||
<Reference Include="System.DirectoryServices.AccountManagement" /> | ||
<Reference Include="System.IdentityModel" /> | ||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Numerics" /> | ||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Runtime.Serialization" /> | ||
<Reference Include="System.Security" /> | ||
<Reference Include="System.ServiceModel" /> | ||
<Reference Include="System.ServiceModel.Web" /> | ||
<Reference Include="System.Text.Encodings.Web, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Text.Encodings.Web.5.0.1\lib\net461\System.Text.Encodings.Web.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Text.Json, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Text.Json.5.0.2\lib\net461\System.Text.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="createAppointement.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<None Include="packages.config" /> | ||
<None Include="test.snk" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net47" /> | ||
<package id="Microsoft.CrmSdk.CoreAssemblies" version="9.0.2.42" targetFramework="net47" /> | ||
<package id="System.Buffers" version="4.5.1" targetFramework="net47" /> | ||
<package id="System.Memory" version="4.5.4" targetFramework="net47" /> | ||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net47" /> | ||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net47" /> | ||
<package id="System.Text.Encodings.Web" version="5.0.1" targetFramework="net47" /> | ||
<package id="System.Text.Json" version="5.0.2" targetFramework="net47" /> | ||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net47" /> | ||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net47" /> | ||
</packages> |
Binary file not shown.