Skip to content

Instantly share code, notes, and snippets.

@bmodeprogrammer
Last active April 13, 2017 09:00
Show Gist options
  • Save bmodeprogrammer/0fcc65f201bc87f64d4610aa9e4b7c76 to your computer and use it in GitHub Desktop.
Save bmodeprogrammer/0fcc65f201bc87f64d4610aa9e4b7c76 to your computer and use it in GitHub Desktop.
Get picklist values JavaScript Remoting
<script src="/soap/ajax/39.0/connection.js" type="text/javascript"></script>
<script>
sforce.connection.sessionId = '{!$Api.Session_ID}';
var result = sforce.connection.describeSObject("Opportunity");
for (var i = 0, size = result.fields.length; i < size; i++) {
var field = result.fields[i];
if (field.name === 'StageName') {
var oPicklistVals = field.picklistValues;
for (var b = 0; b < oPicklistVals.length; b++) {
console.log(oPicklistVals[b].value);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment