function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
I it possible to retrieve values for Picklist object from SF by Android SDK / REST or SOQL?
yes, what i did is :
// reuest to retreive meta data
api.send(_model.getApplicationContenxt(),_model.getToken(), api.requestForDescribeWithObjectType("follow_up_training_dog__c"), this, null);
and on response you just need to go thougth the object and look for pickvalues , for example :
for( int i=0;i<fields.length();i++){ JSONArray pickValues ; JSONObject field = (JSONObject) fields.get(i); String fieldName = field.getString("name"); Log.d("Field name",fieldName); if( fieldName.contains("Walk_area__c")){ pickValues = field.getJSONArray("picklistValues"); String[] walkingArea = new String[pickValues.length()]; for( int j=0;j<pickValues.length();j++){ JSONObject pickvalue = (JSONObject) pickValues.get(j); walkingArea[j] = pickvalue.getString("value"); } _model.walkingAreaNames = walkingArea; }else if (fieldName.contains("assessment_acomp__c")){ pickValues = field.getJSONArray("picklistValues"); String[] accomponiesNames = new String[pickValues.length()]; for( int j=0;j<pickValues.length();j++){ JSONObject pickvalue = (JSONObject) pickValues.get(j); accomponiesNames[j] = pickvalue.getString("value"); } _model.accomponiesNames = accomponiesNames; }else{ Log.d("not equel",fieldName); } }
yes, what i did is :
// reuest to retreive meta data
api.send(_model.getApplicationContenxt(),_model.getToken(), api.requestForDescribeWithObjectType("follow_up_training_dog__c"), this, null);
and on response you just need to go thougth the object and look for pickvalues , for example :
for( int i=0;i<fields.length();i++){
JSONArray pickValues ;
JSONObject field = (JSONObject) fields.get(i);
String fieldName = field.getString("name");
Log.d("Field name",fieldName);
if( fieldName.contains("Walk_area__c")){
pickValues = field.getJSONArray("picklistValues");
String[] walkingArea = new String[pickValues.length()];
for( int j=0;j<pickValues.length();j++){
JSONObject pickvalue = (JSONObject) pickValues.get(j);
walkingArea[j] = pickvalue.getString("value");
}
_model.walkingAreaNames = walkingArea;
}else if (fieldName.contains("assessment_acomp__c")){
pickValues = field.getJSONArray("picklistValues");
String[] accomponiesNames = new String[pickValues.length()];
for( int j=0;j<pickValues.length();j++){
JSONObject pickvalue = (JSONObject) pickValues.get(j);
accomponiesNames[j] = pickvalue.getString("value");
}
_model.accomponiesNames = accomponiesNames;
}else{
Log.d("not equel",fieldName);
}
}