0

I have a SharePoint list with a choice column called "Asset Type". The column available choices are "Type 1", "Type 2" and "Type 3". I'd like to build a script that returns (in any way) only the values that are checked and ignores the rest of them. Any ideas how this can be done?

thanks! Ricardo

1 Answer 1

0

You could use REST api to filter list items.

Sample script:

$.ajax({
     url: _spPageContextInfo.webAbsoluteUrl+"/_api/web/lists/GetByTitle('yourList')/items?$filter=(choiceField eq 'CHOICE1') or (choiceField eq 'CHOICE2')",
     type: "GET",
     headers: {
                "accept": "application/json;odata=verbose"
              },
     success: function (data) {                
        var listItemInfo = '';
        $.each(data.d.results, function (key, value) {
        //to do

           console.log(value.choiceField);
        }) ;
     }, 
     error: function(error) {            
        console.log(JSON.stringify(error));  

     }  
});

Added this thread for your reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.