Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

there was an error while trying to deserialize parameter crm 2015

$
0
0

Hi, I am Sarabjit and trying to execute a code in c#-Linq to update records in CRM but I am getting the following error message :-

"there was an error while trying to deserialize parameter"

I am using :-

Visual Studio 2013

.Net Framework 4.5.2

Console Application

Code is as follows :-

class Program
{
public IOrganizationService _service;

public IOrganizationService GetOrganization()
{
Uri organizationUri = new Uri("lon-dc1/.../Organization.svc");
var cred = new ClientCredentials();
OrganizationServiceProxy _serviceproxy = new OrganizationServiceProxy(organizationUri, null, cred, null);

_serviceproxy.EnableProxyTypes();

_service = (IOrganizationService)_serviceproxy;
return _service;
}
public void Query()
{
MyContext orgContext = new MyContext(_service);
var queryPurchasingManager = from c in orgContext.ContactSet
where (c.JobTitle == null)
select c;

foreach (var a in queryPurchasingManager)
{
a.JobTitle = "Purchasing Supervisor";
orgContext.UpdateObject(a);

Console.WriteLine("{0}'s job title has been updated to Purchasing Supervisor", a["fullname"]);
break;

}
orgContext.SaveChanges(); // On this line I am receiving error
}
static void Main(string[] args)
{
Program p = new Program();
p.GetOrganization();
p.Query();
Console.ReadLine();
}
}

I am receiving error on this line :-

orgContext.SaveChanges();

Kindly help me to resolve the error


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images