엔티티 '계정'에 대한 내 작성 플러그인의 일부 논리를 디자인하려고합니다.Dynamics CRM 2011에서 플러그인으로 중복 레코드를 식별하는 방법
기본적으로 계정 이름을 확인하고 생성시 중복되는 계정 이름을 식별합니다.
예를 들어 계정 이름이 Barclays 인 경우이 인스턴스를 다시 만들려고합니다. 사용자에게 이전에 생성되었다는 오류 메시지가 표시되고이 레코드가 추가되지 않습니다. 코드에서
public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parmameters.
Entity entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName == "account")
{
bool x = true;
if (entity.Attributes.Contains("Name") != recordNamesinCRM)
{
}
else
{
throw new InvalidPluginExecutionException("You Cannot Have Duplicate Country Codes!.");
}
}
}
}
난 그냥 예를 들어 "recordNamesinCRM"를 사용하고 있지만이 기능이나 시스템 또는 방법으로 나머지 새 이름을 만들에 비교하는 방법으로 내장이 확신 위 재발생 사례 계산.
마지막으로 해결 방법을 찾았습니까? 연락처 엔터티의 고유 한 전자 메일 주소 필드를 기반으로 유사한 작업을 수행하고 있습니다. – Andrew