Picklist Information

Layout Operations
getPicklist

The getPicklist query returns an array of the available picklist values and labels for the supplied field, or an empty array. You should provide the Record Type if your object's Record Types use different layouts with different picklist labels. Also dependent picklists can be used by providing a sample value for the dependent picklist's controlling field. Please note that the field needs to be visible and editable for the layout in order for the API to return the applicable values. If you wanted the raw values for this field, please user schema API to parse for this field and all of its values.

var request = { 
	"type" : "getPicklist",
	"object" : "Account",
	"data" : {
        "RecordTypeId" : "001234567891234", // optional
        "SomeControllingField" : "someValue" // optional, data to set primary field(s) for dependent picklist
    },
	"fieldName" : "type"  // required
};
bridge.sendRequest(request, function (results) {
	if (results.type === "picklistResponse")	{
    	var picklistValues = results.data.itemIds; // returns an array of the valid salesforce picklist values
    	var picklistLabels = results.data.itemLabels; // returns an array of the valid salesforce picklist labels
	} else if (results.type == 'error') {
         errStr = results.data;
         alert('A problem occurred:\n' + errStr);
   }
}); 

getUnfilteredPicklist

The getUnfilteredPicklist query returns an unfiltered array of the picklist values and labels for the supplied field. You should provide the Record Type if your object's Record Types use different layouts with different picklist labels.

var request = { 
	"type" : "getUnfilteredPicklist",
	"object" : "Account",
	"data" : { "RecordTypeId" : "001234567891234" }, // data to describe the type of object
	"fieldName" : "type"  // required
};
bridge.sendRequest(request, function (results) {
	if (results.type === "picklistResponse")	{
    	var picklistValues = results.data.itemIds; // returns an array of all salesforce picklist values
    	var picklistLabels = results.data.itemLabels; // returns an array of all salesforce picklist labels
	} else if (results.type == 'error') {
         errStr = results.data;
         alert('A problem occurred:\n' + errStr);
   }
}); 

Related pages