Answered by:
HOW CAN RUN DUPLICTAE DETECTION IN PLUGIN?

Question
-
I CREATE NEW RECORD USING PLUGIN
HOW CAN RUN DUPLICTAE DETECTION BEFOR I CREATE NEW RECORDTuesday, September 29, 2009 11:27 AM
Answers
-
According to the SDK you can use the following code (which is a web based sample, not plugin one -> change the crmService instanciation)
[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Create the account instance and set the name property.
account acct = new account();
acct.name = "Microsoft";
// Create the request object.
RetrieveDuplicatesRequest Request = new RetrieveDuplicatesRequest();
Request.BusinessEntity = acct;
Request.MatchingEntityName = EntityName.account.ToString();
Request.PagingInfo = new PagingInfo();
// Execute the request.
RetrieveDuplicatesResponse Response =
(RetrieveDuplicatesResponse) Service.Execute(Request);- Proposed as answer by Carlton ColterMicrosoft employee Sunday, October 4, 2009 3:20 AM
- Marked as answer by Donna EdwardsMVP Monday, October 12, 2009 2:39 PM
Tuesday, September 29, 2009 11:57 AMModerator -
Tanguy's code will work in a plugin, just make sure to use:
var service = context.CreateCrmService(true);
//before:
// Create the account instance and set the name property. account acct = new account(); acct.name = "Microsoft"; // Create the request object. RetrieveDuplicatesRequest Request = new RetrieveDuplicatesRequest(); Request.BusinessEntity = acct; Request.MatchingEntityName = EntityName.account.ToString(); Request.PagingInfo = new PagingInfo(); // Execute the request. RetrieveDuplicatesResponse Response = (RetrieveDuplicatesResponse) Service.Execute(Request);
- Marked as answer by Donna EdwardsMVP Monday, October 12, 2009 2:39 PM
Sunday, October 4, 2009 3:19 AM
All replies
-
According to the SDK you can use the following code (which is a web based sample, not plugin one -> change the crmService instanciation)
[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Create the account instance and set the name property.
account acct = new account();
acct.name = "Microsoft";
// Create the request object.
RetrieveDuplicatesRequest Request = new RetrieveDuplicatesRequest();
Request.BusinessEntity = acct;
Request.MatchingEntityName = EntityName.account.ToString();
Request.PagingInfo = new PagingInfo();
// Execute the request.
RetrieveDuplicatesResponse Response =
(RetrieveDuplicatesResponse) Service.Execute(Request);- Proposed as answer by Carlton ColterMicrosoft employee Sunday, October 4, 2009 3:20 AM
- Marked as answer by Donna EdwardsMVP Monday, October 12, 2009 2:39 PM
Tuesday, September 29, 2009 11:57 AMModerator -
Tanguy's code will work in a plugin, just make sure to use:
var service = context.CreateCrmService(true);
//before:
// Create the account instance and set the name property. account acct = new account(); acct.name = "Microsoft"; // Create the request object. RetrieveDuplicatesRequest Request = new RetrieveDuplicatesRequest(); Request.BusinessEntity = acct; Request.MatchingEntityName = EntityName.account.ToString(); Request.PagingInfo = new PagingInfo(); // Execute the request. RetrieveDuplicatesResponse Response = (RetrieveDuplicatesResponse) Service.Execute(Request);
- Marked as answer by Donna EdwardsMVP Monday, October 12, 2009 2:39 PM
Sunday, October 4, 2009 3:19 AM