前言
最近,在SharePoint Online上搞事情,用到了2013的作業流,之前也分享了一些相關的內容,今天,又需要在SharePoint Online上審批,于是,就有了下面的方法,親測通過,分享給大家,
正文
| ListName | 作業流任務串列名 |
| Action | 操作名稱,Approved或者Rejected |
| ItemId | 作業流任務的ID |
整個方法比較簡單,其實就是呼叫JavaScript物件模型,更新了作業流任務的幾個屬性而已,但是,比較復雜的就是,要更新哪幾個屬性,既更新了專案,還能讓流程繼續跑下去,于是,試了一晚上,有了下面的方法,我在我這里親測成功,大家如果有問題,就自己調引數就好了,
function approveTask(ListName,Action,ItemId) { var ctx = SP.ClientContext.get_current(); var list = ctx.get_web().get_lists().getByTitle(ListName); this.item = list.getItemById(ItemId); item.set_item('Status',"Completed"); item.set_item('PercentComplete',1); item.set_item('TaskOutcome',Action); item.update(); ctx.executeQueryAsync(Function.createDelegate(this, function(){ console.log("success"); //create success }), Function.createDelegate(this, function(){ //create fail })); }
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/843.html
標籤:SharePoint
