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

Error Adding Connections using REST and oData in Silverlight

$
0
0

Whenever I try to add a new Connection, I get an Exception whose InnerException.Message is "Both objects being connected are missing".

When I step through my code, all the values resolve and are set as indicated in the connToInsert object, but the exception is thrown when the result is retrieved in the OnCreateConnectionComplete method.

I can verify that the Guid values are correct for the Task activity and the Account entity that I'm trying to connect. I can verify that the Task and Account LogicalName variables are set correctly. I can verify that there exists a ConnectionRole called "Activity" and that Task is one of the record types for which it is valid. I can verify that there exists a ConnectionRole called "Company" and that it is valid for the Account entity. And I can verify that the Guid values for these ConnectionRole entities are indeed the ones passed into the new Connection object I'm trying to create.

Has anyone seen this behavior before and, if so, how did you resolve the issue?

My code is as follows:

//pasted from within btnConnect_Click()

Connection connToInsert = new Connection();

connToInsert.Name = theItem.Company.Name; //string variable that resolves properly

connToInsert.Record1Id.Id = new Guid(_activity_id); //activity ID as class variable

connToInsert.Record1Id.LogicalName = _activity_typename; // "task"

connToInsert.Record1RoleId.Id = _activity_connectionRole_Id; // known connection role

connToInsert.Record1RoleId.LogicalName = "connectionrole";

connToInsert.Record2Id.Id = theItem.Company_ID; //Guid variable that resolves properly

connToInsert.Record2Id.LogicalName = "account";

connToInsert.Record2RoleId.Id = _company_connectionRole_id; //known connection role

connToInsert.Record2RoleId.LogicalName = "connectionrole";

_context.AddToConnectionSet(connToInsert);

_context.BeginSaveChanges(OnCreateConnectionComplete, connToInsert);

private void OnCreateConnectionComplete(IAsyncResult result)

{

try

{

_context.EndSaveChanges(result);

Connection createdConn = result.AsyncState as Connection;

lblStatus.text ="Created new connection";

}

catch(SystemException se)

{

throw;

}

}

Thanks,

John


Viewing all articles
Browse latest Browse all 79901

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>