我正在研究文档批准模板,并使用下面的代码成功添加了默认批准者。
App Maker Document approval template : How can I Add Default Approvers
我的问题是,在app maker中添加了这些代码之后,功能notifyApproversAboutRequest_(request)仍然可以工作,但是功能notifyOwnerAboutRequestRejected(request)和函数notifyOwnerAboutRequestApproved_(request)不再起作用。谁能告诉我如何解决这个问题?谢谢!
if (requestDs.item.WorkflowStages.length === 0) {
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'darpan.sanghavi@abc.com';
draft.Name = 'Darpan Sanghavi';
createDatasource.createItem(function(createdRecord) { });
});
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.OrderNo =
getNextOrderNumberForApprover(requestDs.item);
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'darpan.sanghavi@xyz.com';
draft.Name = 'Darn Alarm';
createDatasource.createItem(function(createdRecord) { });
app.closeDialog();
});
}
答案 0 :(得分:0)
我能够解决这些更改。 都可以使用notifyOwnerAboutRequestRejected(request)和函数notifyOwnerAboutRequestApproved_(request):
if (requestDs.item.WorkflowStages.length === 0) {
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'Test@test.com.br';
draft.Name = 'Test';
createDatasource.createItem(function(createdRecord) { });
});
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.OrderNo =
getNextOrderNumberForApprover(requestDs.item);
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'test2@test.com.br';
draft.Name = 'Test2';
createDatasource.createItem(function(createdRecord) { });
app.closeDialog();
});
} else {
app.closeDialog();
}
},
failure: function() {
app.closeDialog();
}
});
}
非常感谢您的代码,它可以分阶段解决我的问题。