Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("document").ready(function () {
- retrieveConfigParam("Installation"); //calls fxSetPermissions through fxSuccess if CamlQuery returns TRUE, skips if FALSE.
- });
- function retrieveConfigParam(ConfigProcess) {
- var ctx = SP.ClientContext.get_current();
- var oList = ctx.get_web().get_lists().getByTitle('lstConfigParameters');
- var camlQuery = new SP.CamlQuery();
- camlQuery.set_viewXml(
- '<Query><Where><Eq><FieldRef Name=' + ConfigProcess + ' /><Value Type=”Text”>Installation</Value>' +
- '</Eq></Where></Query>');
- this.collListItem = oList.getItems(camlQuery);
- ctx.load(collListItem);
- ctx.executeQueryAsync(Function.createDelegate(this, this.CamlSuccess), Function.createDelegate(this, this.fxFail));
- }
- function CamlSuccess () {
- var listItemInfo = '';
- var listItemEnumerator = collListItem.getEnumerator();
- while (listItemEnumerator.moveNext()) {
- var oListItem = listItemEnumerator.get_current();
- listItemInfo += oListItem.get_item('Boolean');
- var xID = oListItem.get_id();
- alert("xID == " + xID);
- }
- alert(listItemInfo.toString());
- if (listItemInfo == "true") {
- alert("set permissions...");
- fxSetPermissions();
- fxUpdateListItem(xID);
- }
- }
- function fxUpdateListItem(xID) {
- var ctx = SP.ClientContext.get_current();
- var oList = ctx.get_web().get_lists().getByTitle('lstConfigParameters');
- this.oListItem = oList.getItemById(xID);
- oListItem.set_item('Boolean', false);
- oListItem.update();
- ctx.executeQueryAsync(
- Function.createDelegate(this, this.fxUpdated),
- Function.createDelegate(this, this.fxFailed)
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement