-
-
Save princeppy/a8e2fc123e77d449b54d0dbdacc77d57 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| createsitecolumn: function () { | |
| var fieldschema = '<Field Type="' + sitecolumntype + '" Name="' + sitecolumnname + '" DisplayName="' + sitecolumndisplayname + '" Group="JSOM Provisioned Columns" />'; | |
| var dfd = $.Deferred(); | |
| var ctx = getContext(); | |
| var appctx = getAppContextSite(ctx); | |
| var targetWeb = appctx.get_site().get_rootWeb(); | |
| var fields = targetWeb.get_fields() | |
| fields.addFieldAsXml(fieldschema, false, SP.AddFieldOptions.addFieldCheckDisplayName); | |
| ctx.executeQueryAsync(function () { dfd.resolve(); }, function (sender, args) { | |
| console.log("Column creation failure: " + args.get_message()); | |
| dfd.reject(); | |
| }); | |
| return dfd.promise(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment