-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreCreateAcount.cs
35 lines (29 loc) · 1005 Bytes
/
PreCreateAcount.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Helper;
using Microsoft.Xrm.Sdk;
using Newtonsoft.Json;
using System;
namespace DependentAssemblyExample
{
public class PreCreateAcount : PluginBase
{
public PreCreateAcount(string unsecureConfiguration, string secureConfiguration) : base(typeof(PreCreateAcount))
{
}
protected override void ExecuteCdsPlugin(ILocalPluginContext localPluginContext)
{
if (localPluginContext == null)
{
throw new ArgumentNullException(nameof(localPluginContext));
}
var context = localPluginContext.PluginExecutionContext;
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
var entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName == "account")
{
entity["name"] = AccountHelper.GetName();
}
}
}
}
}