function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BerutielBerutiel 

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 :

Dog Name

Edit | Del Dog_Name__cMaster-Detail(כלב) Required Filtered Lookup רפי טגליכט, 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 Information
Field LabelDog NameObject Nameמעקב אחר כלב באימון
Field NameDog_NameData TypeMaster-Detail
API NameDog_Name__c  
Description 
Help Text 
Created ByAdmin Admin, 08/08/2011 23:15Modified Byרפי טגליכט, 18/10/2011 11:24
Master-Detail Options
Related ToכלבChild Relationship NameFollow_Up_Training_Dogs
Related List Labelמעקב אחר כלבים באימון
Sharing SettingRead/Write. Allows users with at least Read/Write access to the Master record to create, edit, or delete related Detail records.
Lookup Filter
Filter Criteria
Dog Name: dog's statusEQUALSdog assessed for training, dog assessed for breeding stock, dog in further assessment, dog in training
Filter TypeRequired. The user-entered value must match filter criteria.
Error MessageValue does not exist or does not match filter criteria.
Lookup Window Text 
ActiveChecked


 

 

 


Dirk GronertDirk Gronert

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

 
Dirk GronertDirk Gronert

There is alos a template project to start ...