我有一段启动工作流程的JavaScript代码。 这一切都适用于我的内部开发机器。 但是一旦我尝试在在线网站上运行它,它就会失败。
它基于workflow.asmx网络服务,我收到错误500 - 价值不会落在预期范围内...
我怀疑这是在工作流程参数中。但我看不出究竟是什么。用户登录有所不同,但它符合oneline格式...
任何关于内部部署与在线之间可能存在的差异的想法可以解释这一点吗?
以防万一,这是我的代码(再次,完美的onpremise):
function StartMyWorkflow(listGUID, itemId) {
var wfDefinitionId = "{9279E1FF-1D32-4423-85B7-C7F21998A701}";
var ctx = SP.ClientContext.get_current();
var web = ctx.get_web();
var list = web.get_lists().getById(listGUID);
var item = list.getItemById(itemId);
var currentUser = web.get_currentUser();
ctx.load(web);
ctx.load(item);
ctx.load(currentUser);
ctx.executeQueryAsync(
Function.createDelegate(this, function () {
var login = currentUser.get_loginName();
var name = currentUser.get_title();
var xml = getWFAssocData(name, login);
var fileRef = "https://" + location.host + item.get_item("FileRef");
$().SPServices({
operation: "StartWorkflow",
item: fileRef,
templateId: wfDefinitionId,
workflowParameters: xml,
completefunc: function () {
SP.UI.Notify.addNotification('workflow started', false);
}
});
}),
function (s, a) { console.error(a.get_message());}
);
}
function getWFAssocData(name, login) {
var assocData = '<dfs:myFields xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' +
'<dfs:queryFields></dfs:queryFields>' +
'<dfs:dataFields>' +
'<d:SharePointListItem_RW>' +
'<d:Approvers>' +
'<d:Assignment>' +
'<d:Assignee>' +
'<pc:Person><pc:DisplayName>' + name + '</pc:DisplayName><pc:AccountId>' + login + '</pc:AccountId><pc:AccountType>User</pc:AccountType></pc:Person>' +
'</d:Assignee>' +
'<d:Stage xsi:nil="true" />' +
'<d:AssignmentType>Serial</d:AssignmentType>' +
'</d:Assignment>' +
'</d:Approvers>' +
'<d:ExpandGroups>true</d:ExpandGroups>' +
'<d:NotificationMessage>Please approve <a href="#1">test</a></d:NotificationMessage>' +
'<d:DueDateforAllTasks xsi:nil="true" /><d:DurationforSerialTasks xsi:nil="true" />' +
'<d:DurationUnits>Day</d:DurationUnits>' +
'<d:CC />' +
'<d:CancelonRejection>true</d:CancelonRejection>' +
'<d:CancelonChange>false</d:CancelonChange>' +
'<d:EnableContentApproval>false</d:EnableContentApproval>' +
'</d:SharePointListItem_RW>' +
'</dfs:dataFields>' +
'</dfs:myFields>';
return assocData;
}
答案 0 :(得分:0)