03-16-2011 03:24 PM
Hi all,
How can I create a payload and what I have to do, for adding a new contact to an existing account ? I have the account id.
Thanks,
Marcelo.
03-17-2011 10:16 AM
Hi,
To be more spcecific I will provide the code that is returning error 500, I want to simple add a new contact to an existing account using SDATA, I have contact fname,lname,mail and account id.
ISDataService service = SDataDataService.mydataService();
var entry = new AtomEntry();
var payload = new SDataPayload
{
ResourceName = "Contact",
Namespace =
"http://schemas.sage.com/dynamic/2007",
Values = {
{"LastName", txtLName.Text},
{"FirstName", txtFName.Text},
{"Email",txtEmail.Text},
}
};
payload.Values["Account"]=new SDataPayload {Key = "ADEMOA00003Q"};//this is an existing accid
entry.SetSDataPayload(payload);
var request = new SDataSingleResourceRequest(service, entry) { ResourceKind = "contacts" };
AtomEntry result = request.Create();
03-22-2011 12:40 PM - edited 03-22-2011 12:44 PM
disregard. thought you had a misspelling.
03-24-2011 02:34 PM
I just did this in our implementation. Make sure that you create the related entities for the Contact (such as Address), otherwise you will get errors.
Also, when debugging, inspect the InnerException property for the Exception thrown. It usually contains the specifics; the parent error is just a generic 500 error.
02-13-2013 05:32 AM