вот код:
Код:
public void Execute(IPluginExecutionContext context)
{
DynamicEntity entity = null;
if (context.InputParameters.Properties.Contains(ParameterName.Target) &&
context.InputParameters.Properties[ParameterName.Target] is DynamicEntity)
{
entity = (DynamicEntity)context.InputParameters.Properties[ParameterName.Target];
}
else
{
return;
}
try
{
lock (_sync)
{
// simple query to get incremental settings for this entity
using (ICrmService service = context.CreateCrmService(true))
{
IncrementalNumbering setting = IncrementalNumbering.GetSettings(service, entity.Name);
// system generated, if its assigned ignore this record
if (setting != null && !entity.Properties.Contains(setting.PropertyName))
{
int next = setting.CurrentPosition + 1;
StringProperty increment = new StringProperty(setting.PropertyName,setting.Prefix.ToString()+ next.ToString());
entity.Properties.Add(increment);
// keep track of the latest id inside the custom entity
setting.Increment(service, next);
}
}
}
}
catch (System.Web.Services.Protocols.SoapException ex)
{
........
}
}
если я правильно понял, то нужно создать свой метод в котором будет происходить подключение к СРМ?