**I have created a custom edit form for a SharePoint online custom list. Where I have created a custom button via which I will start a Workflow.
the issue is I am not able to call that function on button click. I have used a single comma also for the function call
我为SharePoint在线自定义列表创建了自定义编辑表单。我在哪里创建了一个自定义按钮,通过它我将启动一个工作流程。 问题是我无法在按钮点击时调用该功能。我还使用了一个逗号来进行函数调用**
HTML按钮代码:
<td class="ms-toolbar" nowrap="nowrap" align="right">
<input type="button" runat="server" value="Assign To Next Step" name="AssignToNextStep" onClick="startWorkflow()"/>
</td>
JavaScript函数代码是:
<script type="text/javascript">
function startWorkflow()
{
alert("Inside");
try
{
showInProgressDialog();
var ctx = SP.ClientContext.get_current();
var wfManager = SP.WorkflowServices.WorkflowServicesManager.newObject(ctx, ctx.get_web());
var subscription = wfManager.getWorkflowSubscriptionService().getSubscription("My Workflow ID");
ctx.load(subscription, 'PropertyDefinitions');
ctx.executeQueryAsync(
function(sender, args)
{
wfManager.getWorkflowInstanceService().startWorkflow(subscription, "");
ctx.executeQueryAsync(
function(sender, args)
{
closeInProgressDialog();
},
function (sender, args)
{
closeInProgressDialog();
alert(errorMessage);
});
});
}
catch(ex)
{
alert(ex);
dlg.close();
}
}
</script>
答案 0 :(得分:1)
该功能超出范围。我的意思是我只是改变了那个功能的位置。
答案 1 :(得分:0)
如何插入代码?如果显示任何错误,您是否在浏览器中检查过开发人员工具?
尝试添加
onClick="startWorkflow();return false;"
在您的代码中。