Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: Update HTML Document Item Properties using it's Element Values

Here is what I have on this. I finally felt I have learn enough to take a stab at it. Its not working because the number of items that have to load, but I am working on the looping. I have seen what has been posted but the promise stuff is out of my league. Since this script is just running form an HTML page, I am not opposed to using inputs to control block and just changing the values and rerunning it.

thanks!
$(document).ready(function () {
//function loadblock () {
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "{d3498759-c3f5-4678-8efc-29ed4217bf2f}",
        CAMLQuery: "<Query><Where><Neq><FieldRef Name='RiskScore'></FieldRef><Value Type='Integer'></Value></Neq></Where></Query>",
        CAMLViewFields: "<ViewFields><FieldRef Name='LinkFilenameNoMenu' /><FieldRef Name='ID' /></ViewFields>",
        completefunc: function (xData, Status) {       
            $(xData.responseXML).SPFilterNode("z:row").each(function () {
                var qURL = "https://appservicesstd.wss.pncbank.com/CSB/BBS/1J/Test/" + $(this).attr("ows_LinkFilenameNoMenu"); //+ ".htm";
                var qID = $(this).attr("ows_ID")
                    //alert(qURL);
               $("#eval").load(qURL + "#divEvaluation", loadeval(qURL, qID));
            });
            
        }
    });
};
});
function loadeval(qURL, qID) {
    return function () {
        if ($('#Section40431477_txtScore').length > 0){
            var Osc = $('#Section40431477_txtScore').html();
            var RMsc = $('#Section40431477_Category40431484_Element40431497_txtScore').html();
            var RMcom = $('#Section40431477_Category40431484_Element40431497_txtComment').html();
            var CAsc = $('#Section40431477_Category40431484_Element40431497_txtScore').html();
            var CAcom = $('#Section40431477_Category40431485_Element40431498_txtComment').html();
            var COsc = $('#Section40431477_Category40431486_Element40431499_txtScore').html();
            var COcom = $('#Section40431477_Category40431486_Element40431499_txtComment').html();
            var KEsc = $('#Section40431477_Category40431487_Element40431500_txtScore').html();
            var KEcom = $('#Section40431477_Category40431487_Element40431500_txtComment').html();
            var BAsc = $('#Section40431477_Category40431488_Element40431501_txtScore').html();
            var BAcom = $('#Section40431477_Category40431488_Element40431501_txtComment').html();
         }
         else {
              var Osc = $('#Section41258633_txtScore').html();
            var RMsc = $('#Section41258633_Category41258641_Element41258657_txtScore').html();
            var RMcom = $('#Section41258633_Category41258641_Element41258657_txtComment').html();
            var CAsc = $('#Section41258633_Category41258642_Element41258658_txtScore').html();
            var CAcom = $('#Section41258633_Category41258642_Element41258658_txtComment').html();
            var COsc = $('#Section41258633_Category41258643_Element41258659_txtScore').html();
            var COcom = $('#Section41258633_Category41258643_Element41258659_txtComment').html();
            var KEsc = $('#Section41258633_Category41258644_Element41258660_txtScore').html();
            var KEcom = $('#Section41258633_Category41258644_Element41258660_txtComment').html();
            var BAsc = $('#Section41258633_Category41258645_Element41258661_txtScore').html();
            var BAcom = $('#Section41258633_Category41258645_Element41258661_txtComment').html();
       }                
        //alert(RMsc)
        //$('#testscore').html(RMsc);
        //$('#testcomments').html(RMcom);
        $().SPServices({
            operation: "UpdateListItems",
            async: false,
            batchCmd: "Update",
            listName: "{d3498759-c3f5-4678-8efc-29ed4217bf2f}",
            ID: qID,
            valuepairs: [
                ["RiskScore", RMsc],
                ["RiskComments", RMcom],
                ["CustomerAdvocateScore", CAsc],
                ["CustomerAdvocateComments", CAcom],
                ["CommunicatorScore", COsc],
                ["CommunicatorComments", COcom],
                ["KnowledgeScore", KEsc],
                ["KnowledgeComments", KEcom],
                ["BrandAmbassadorScore", BAsc],
                ["BrandAmbassadorComments", BAcom]      
            ],
            completefunc: function (xData, Status) {
                //alert("completed");
            }
        });
    }
}

Viewing all articles
Browse latest Browse all 6517

Trending Articles