Reputation: 1283
I've expirienced a very odd behaviour of my CRM 2011 API. When I try to update originatingleadid
field of contact from one value to another nothing happes. No any errors in code, so when executing code everything looks perfect. But the value doesn't really changes.
I wrote a simple method to test it and have got same result. Here is it.
class Program
{
private static IOrganizationService service;
static void Main(string[] args)
{
var contactId = Guid.Parse("B5A832D6-93DD-E611-ABAC-005056810E95");
var leadId = Guid.Parse("8306E695-94DD-E611-ABAC-005056810E95");
getService("admin", "password", "domain");
SetOriginatingLead(contactId, leadId);
}
private static void SetOriginatingLead(Guid contactId, Guid leadId)
{
var entity = service.Retrieve("contact", contactId,
new ColumnSet("originatingleadid"));
var targetlead = new EntityReference("lead", leadId);
entity["originatingleadid"] = targetlead;
service.Update(entity);
return;
}
private static void getService(string login, string password, string domain)
{
if (service != null)
return;
var cred = new ClientCredentials();
cred.Windows.ClientCredential =
new NetworkCredential(login, password, domain);
service = new OrganizationServiceProxy(new
Uri(@"http://crm/organisation/XRMServices/2011/Organization.svc"), null, cred, null);
return;
}
}
Please, tell me where am I mistaken.
Upvotes: 2
Views: 916