You need to sign in to do that
Don't have an account?
Please , help me , i can't save new object from android in salesforce
i'm trying to develop android application with integration to salesforce. i downloaded salesforcesdk.jar library . i managed to retrieve some values from salesforce but i failed to save values that user fills in . i'm trying to insert it to follow_up_training_dog__c the only required field in this object is :
Edit | Del | Dog_Name__c | Master-Detail(כלב) | רפי טגליכט, 18/10/2011 11:24 |
it's master detail and related to Dogs__c table
my code looks like this:
JSONObject data = new JSONObject();
try{
data.put("assessment_acomp__c", mSelectionAccomponyAreaName);
data.put("Walk_area__c", mSelectionWalkAreaName);
data.put("Dog_Name__c", mSelectionDogName);
}catch (JSONException e){
e.printStackTrace();
}
SFRestAPI api = SFRestAPI.getApi();
_handlersClass = handlers;
_model = Singeltone.getInstance();
try
{
api.send(_model.getApplicationContenxt(),_model.getToken(), api.requestForCreateWithObjectType("follow_up_training_dog__c", data), this, null);
} catch (SFRestException e) {
e.printStackTrace();
displayError(e.error_description);
}
i tried to execute this request in https://workbench.developerforce.com/restExplorer.php
and it succeeded .
in the body i wrote
{"Dog_Name__c":"a0AM0000000ji1h"}
i got "bad api request " error
please help , i have no idea what to do?
these are the properties of relation
Custom Field Definition Detail |
Field Label | Dog Name | Object Name | מעקב אחר כלב באימון |
Field Name | Dog_Name | Data Type | Master-Detail |
API Name | Dog_Name__c | ||
Description | |||
Help Text | |||
Created By | Admin Admin, 08/08/2011 23:15 | Modified By | רפי טגליכט, 18/10/2011 11:24 |
Related To | כלב | Child Relationship Name | Follow_Up_Training_Dogs |
Related List Label | מעקב אחר כלבים באימון | ||
Sharing Setting | Read/Write. Allows users with at least Read/Write access to the Master record to create, edit, or delete related Detail records. |
Filter Criteria | Dog Name: dog's statusEQUALSdog assessed for training, dog assessed for breeding stock, dog in further assessment, dog in training |
Filter Type | Required. The user-entered value must match filter criteria. |
Error Message | Value does not exist or does not match filter criteria. |
Lookup Window Text | |
Active |
Pls have a look into our Salesforce Android SDK at https://github.com/forcedotcom/SalesforceMobileSDK-Android ! There is the source code of the sdk and also a sample app (CloudTunes) ... You should use the RestClient with the RestRequest ...
--dirk
There is alos a template project to start ...