-
-
Save eirikb/1b1186ab2c7dd0370864 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkIfFieldExists(ctx, list, fieldName, cb) { | |
ctx.load(list.get_fields().getByInternalNameOrTitle(fieldName), 'Id'); | |
ctx.executeQueryAsync(function() { | |
cb(true); | |
}, function() { | |
cb(false); | |
}); | |
} | |
var c = SP.ClientContext.get_current(); | |
var l = c.get_web().get_lists().getByTitle('Test'); | |
checkIfFieldExists(c, l, 'FailField', function(exists) { | |
console.log('Field exists:', exists); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment