Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get all internal field names using JavaScript
async function GetFields(listTitle){
let data = await fetch(`${_spPageContextInfo.siteServerRelativeUrl}/_api/web/lists/GetByTitle('Users')/Fields?$filter=Hidden%20eq%20false`,
{
headers: {"Accept":"application/json;odata=verbose"}
});
let fields = await data.json();
console.log(fields.d.results.map(field=>`${field.Title} | ${field.InternalName}\n\r`).join("") );
}
// pass the list name:
GetFields("Users")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.