I want to accomplish this feat in programming in C# for CRM.
- Check if the contact exists, if it does not, then create the contact.
- The conflict I'm facing is if the contact exists, only the last name is a required field which makes checking the data challenging and there may be more than 1 contact that might be erroneously entered.
Here's my code, I can only figure out how to create a GUID using the last name but Not on more than one field. Can someone shed some light on this and provide your thoughts from those who has more experience in this field?
How can I check on more than just the last name? Perhaps 'lastname' , 'firstname' , and 'Company'?
Thanks in advance!
string firstName= "John"; string lastName = "Doe"; var ContactValue = GetEntityCollection(_service, "contact", "lastname", lastName, new ColumnSet("contactid", "lastname")); //does it return anything Guid contactpersonid = (Guid)ContactValue[0].Id; salesorder["neu_orderedbyid"] = new EntityReference("contact", new Guid(contactpersonid.ToString()));