Hi nick_warren,
I need to specify. The field returned is RecordID not Record_ID. If you have a custom field called Record_ID and are trying to retrieve that, it may not be populated if you don't populate it during the insert.
Let's walkthrough a quick simple example of what you're doing. At no point will I sync with quickbooks. The example is in C# and assumes you already have the appropriate service references added.
Step 1. Add the new customer. Two fields are required. Name and Contact. I will use DaveCustomer and DaveContact for their respective values.
string[ arrInsertFieldsArray = new string[ { "Name", "Contact" };
string[ arrInsertValueArray = new string[ { "DaveCustomer", "DaveContact" };
lblMethodAPIInsertV2.Text = _MethodAPI.MethodAPIInsertV2(CompanyAccount, Login, Password, "", "Customer", arrInsertFieldsArray, arrInsertValueArray)
In my case, I'm writing the values to a label. At this point my label text is
<?xml version="1.0" encoding="windows-1252" ?><MethodAPI response = "SuccessSendToDesktop" RecordID="163" ></MethodAPI>
Step 2. Parse the xml to get the recordid (in this case 163).
How you do that is up to you.
Step 3. Retrieve Customer with RecordID 163 from your account
Using MethodAPISelect_DataSetV2 (Don't forget you need to pass in a dataset by ref, where the record will be returned)
System.Data.DataSet ReturnDS = null;
lblMethodAPISelect_DataSetV2.Text = _MethodAPI.MethodAPISelect_DataSetV2(CompanyAccount, Login, Password, "", ref ReturnDS, "Customer", "RecordID, Name", "RecordID = 163", "", "", "");
//ReturnDS now has a datatable with one record in it
Using MethodAPISelect_XMLV2
lblMethodAPISelect_XMLV2.Text = _MethodAPI.MethodAPISelect_XMLV2(CompanyAccount, Login, Password, "", "Customer", "RecordID, Name", "RecordID = 163", "", "", "")
//lblMethodAPISelect_XMLV2.Text is now <?xml version="1.0" encoding="windows-1252" ?><MethodAPI response = "Success" MaxRecords= "False"><MethodIntegration Table='Customer'> <Record> <RecordID>163</RecordID> <Name>DaveCustomer2</Name> </Record> </MethodIntegration></MethodAPI>
At no point has a quickbooks sync been done. But I have successfully added and retrieved a customer via the API
Dave