Hi,
Today i was suppose to write a callout which would be sending email to owner’s manager for our opportunity entity.
I thought before trying out with an callout(which is really hard to debug) i should try it first in a windows application. Finally after some time i was able to get it working.
So than i decided to put the same code in the callout as well. But to my surprise i found that the same code was not working in the callout.
This was the error i was getting as
ex.detail.innerxml // for (SoapException ex)
<error>
<code>0x80040237</code>
<description>Operation failed due to a SQL integrity violation.</description>
<type>Platform</type>
</error>
After searching on the internet for the same i was able to find the cause for the error in my code
For my windows application this piece of code was sufficient
CrmService service=new CrmService();
service.Credentials=System.Net.CredentialCache.DefaultCredentials;
service.Url=”http://d-2927:5555/mscrmservices/2006/crmservice.asmx”;
But when it came to callout it had to be
CrmService service=new CrmService();
service.Credentials=System.Net.CredentialCache.DefaultCredentials;
service.Url=”http://d-2927:5555/mscrmservices/2006/crmservice.asmx”;
service.CallerIdValue = new CallerId();
service.CallerIdValue.CallerGuid =userContext.UserId;
This helped me to solve the error.
Check this link as well
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1768766&SiteID=1
Bye
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.
