I have a method that adds a SiteColumn to an existing ContentType:

addFieldToContentType: function(fieldSTR, contentTypeSTR, successFUN) { var clientContextOBJ = (csListBuilder.contextURL != "") ? new SP.ClientContext(csListBuilder.contextURL) : new SP.ClientContext.get_current(); var webContextOBJ = clientContextOBJ.get_web();

//get content types
var contentTypesARY = clientContextOBJ.get_site().get_rootWeb().get_contentTypes(); 

clientContextOBJ.executeQueryAsync(function() {
    var numeratorOBJ = contentTypesARY.getEnumerator();
    var loopBLN = true;
    var contentTypeOBJ;

    //loop through all content types to get to our wanted one
    while (numeratorOBJ.moveNext() && loopBLN == true) {
        contentTypeOBJ = numeratorOBJ.get_current();
        loopBLN = (contentTypeOBJ.get_name() == contentTypeSTR) ? false : true;

    //Build the field Info and add it to the content type object
    var fieldOBJ = clientContextOBJ.get_site().get_rootWeb().get_fields().getByInternalNameOrTitle(fieldSTR);           
    var infoOBJ = new SP.FieldLinkCreationInformation();


    clientContextOBJ.executeQueryAsync(successFUN, function(senderOBJ, argsOBJ){
        if(csListBuilder.alertErrorsBLN) {
            alert('Failed: ' + argsOBJ.get_message());
        } else {
            console.log('Failed: ' + argsOBJ.get_message());

}, null);       


If you do that manually via GUI there is the option "Update all content types inheriting from this type?" How can I do this programmatically via JSOM? Is there a way to do it automatically (with just adding a flag)?

1 Answer 1


Try adding the parameter true to the content type update call. Change that line of your code to:


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.