How to get Choice field values in SharePoint using REST api
Get Choice field values in SharePoint using REST api
To get values of a choice type column in SharePoint list refer the below method which will give you the all choice type column's values. Just write your list and column name in the below method and you will get your response in the console.
function getChoices(){
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl +"_api/web/lists/GetByTitle('List Name')/fields?$filter=EntityPropertyName eq 'Choice Field Name'",
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
},
success: function (data) {
console.log(data.d.results[0].Choices.results);
},
error: function (error) {
alert(JSON.stringify(error));
}
});
}
Comments
Post a Comment