Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
New Member
Posts: 26
Registered: ‎02-21-2011

SDATA save new contact to an existing account

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.

 

New Member
Posts: 26
Registered: ‎02-21-2011

Re: SDATA save new contact to an existing account

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();

Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Re: SDATA save new contact to an existing account

[ Edited ]

disregard. thought you had a misspelling.

Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Re: SDATA save new contact to an existing account

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.

New Member
Posts: 1
Registered: ‎02-13-2013

Re: SDATA save new contact to an existing account

Marcelo,

If you were able to resolve this update: Can you post your code?

Thanks,

Carla