jquery - Best method to create links to List Item's Workflow using results of SPServices - GetListItems -
i using spservices - getlistitems ajax retrieve data sharepoint 2010 kendo grid. bind title url template. works okay (except 1 grid's linkouts generates cross-site scripting error clicks through item. odd, because page , link in same site).
i prefer link underlying workflow instance, cannot find unique id required in of results or underlying xml data (as viewed through stramit caml viewer) returned getlistitems.
this feels clunky , hard-coded, , break if changes particular environments lists.
in perfect world, able retrieve entire link listitem shows in sharepoint , emit in custom page.
is there way this?
edit list items retrieving library columns display links take item's associated workflow. want link directly workflow item displayed in grid, if looking @ document library in sharepoint. code:
var carformdata = []; $(document).ready(function () { $().spservices({ operation: "getlistitems", async: false, listname: "car form", camlviewfields: "<viewfields><fieldref name='workflowinstanceid' /><fieldref name='title' /><fieldref name='modified' /><fieldref name='car_x0020_id' /><fieldref name='phase1fi' /><fieldref name='phase2ex' /><fieldref name='appceo' /></viewfields>", camlquery: "<query><where><eq><fieldref name='author' /><value type='user'><userid /></value></eq></where><orderby><fieldref name='modified' ascending='false' /></orderby></query>", completefunc: function (xdata, status) { $(xdata.responsexml).spfilternode("z:row").each(function () { carformdata.push({ title: $(this).attr("ows_title"), modified: $(this).attr("ows_modified"), carid: $(this).attr("ows_car_x0020_id") != undefined ? $(this).attr("ows_car_x0020_id") : "", phase1: $(this).attr("ows_phase1fi") != undefined ? workflowstatuscodes[$(this).attr("ows_phase1fi")] : "", phase2: $(this).attr("ows_phase2ex") != undefined ? workflowstatuscodes[$(this).attr("ows_phase2ex")] : "", phase3: $(this).attr("ows_appceo")!= undefined ? workflowstatuscodes[$(this).attr("ows_appceo")] : "", workflowid: $(this).attr("ows_workflowinstanceid") //note: never has value, though these list items associated workflow, , display link them when viewing library }); }); } }); $("#gridcar").kendogrid({ sortable: true, columns: [ { field: "title", title: "name", template: "<a href='/cis/car%20form/${ title }'>${ title }</a>" }, { field: "modified", title: "modified", format: "{0: mm/dd/yyyy}", width: 80, headerattributes: { style: "text-align: center" }, attributes: { style: "text-align: center" } }, { field: "carid", title: "car id", width: 80, headerattributes: { style: "text-align: center" }, attributes: { style: "text-align: center" } }, { field: "phase1", title: "phase 1 - finance & accounting", width: 192 }, { field: "phase2", title: "phase 2 - executive approval", width: 182 }, { field: "phase3", title: "phase 3 - ceo approval", width: 151 } ], datasource: { data: carformdata, schema: { model: { fields: { title: { type: "string" }, modified: { type: "date" }, carid: { type: "string" }, phase1: { type: "string" }, phase2: { type: "string" }, phase3: { type: "string" } } } } } }); });
Comments
Post a Comment