Discussion:
Getting Generic SQL Error
(too old to reply)
Sourab Gupta
2010-04-30 19:11:01 UTC
Permalink
Hi all i am getting a Generic SQl Error when i try to create the phone call
activity from plugin.

phonecall call = new phonecall();


// set the regarding
call.regardingobjectid = new Lookup();
call.regardingobjectid.type = EntityName.new_po.ToString();
call.regardingobjectid.Value = new Guid(poid.ToString());

activityparty to = new activityparty();
to.partyid = new Lookup();
to.partyid.type = EntityName.contact.ToString();
to.partyid.Value = new
Guid(so.new_contactid.Value.ToString());
call.to = new activityparty[] { to };

//owner
Owner owner = new Owner();
owner.type = EntityName.systemuser.ToString();
owner.Value = new Guid(userid.ToString());
call.ownerid = owner;

call.directioncode = new CrmBoolean();
call.directioncode.Value = false;

call.scheduledend = new CrmDateTime();
call.scheduledend =
ConvertToCRMDateTime(Convert.ToDateTime(so.new_datetime.Value).ToLocalTime());

//Create the phone call
TargetCreatePhoneCall target = new TargetCreatePhoneCall();
target.PhoneCall = call;

CreateRequest request = new CreateRequest();
request.Target = target;

CreateResponse response =
(CreateResponse)crmService.Execute(request);
unknown
2010-05-05 14:53:01 UTC
Permalink
Hi,

I recomened that you use DynamicEntity, for the plugin it is better to use
this class. And put all your code in the try-catch and use the SoapException.
When you see the error, please send us the details. Although these errors
always happen when you have some codes customized for example In your code I
saw that you have new field for example new_po.

Below is the link where you could see a example of DynamicEntity

http://msdn.microsoft.com/en-us/library/cc905760.aspx


Regards



Atilio
Post by Sourab Gupta
Hi all i am getting a Generic SQl Error when i try to create the phone call
activity from plugin.
phonecall call = new phonecall();
// set the regarding
call.regardingobjectid = new Lookup();
call.regardingobjectid.type = EntityName.new_po.ToString();
call.regardingobjectid.Value = new Guid(poid.ToString());
activityparty to = new activityparty();
to.partyid = new Lookup();
to.partyid.type = EntityName.contact.ToString();
to.partyid.Value = new
Guid(so.new_contactid.Value.ToString());
call.to = new activityparty[] { to };
//owner
Owner owner = new Owner();
owner.type = EntityName.systemuser.ToString();
owner.Value = new Guid(userid.ToString());
call.ownerid = owner;
call.directioncode = new CrmBoolean();
call.directioncode.Value = false;
call.scheduledend = new CrmDateTime();
call.scheduledend =
ConvertToCRMDateTime(Convert.ToDateTime(so.new_datetime.Value).ToLocalTime());
//Create the phone call
TargetCreatePhoneCall target = new TargetCreatePhoneCall();
target.PhoneCall = call;
CreateRequest request = new CreateRequest();
request.Target = target;
CreateResponse response =
(CreateResponse)crmService.Execute(request);
Loading...