App Maker文档批准模板:如何添加默认批准者 [英] App Maker Document approval template : How can I Add Default Approvers

查看:76
本文介绍了App Maker文档批准模板:如何添加默认批准者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用文档批准模板,并且想定义默认的批准人和阶段.

我试图通过将位置从onValueChange更改为onAttach来更改与EditRequest页面中userpicker小部件关联的自定义值,以定义默认批准者.我为邮件的批准者设置了默认值.

PageEditRequest/userPickerWidget:

函数与userPickerWidget的自定义值相关联:

但是我不知道如何将新阶段与另一个批准者相关联...

我尝试了很多失败的事情

您有什么想法吗?

我希望在没有任何客户端交互的情况下获得这种类型的结果:

所需结果:

解决方案

早期的答案指向解决用户手动添加舞台的问题.如果要自动添加所有阶段和所有批准者列表,请执行以下步骤.

  1. 打开编辑请求"页面,在该页面中您可以找到事件onAttach,该事件将在页面加载和数据尚未加载时触发. DMS模板已经为该事件提供了名为startLoading()的方法.
  2. 在名为EditRequestPage_Request的客户端脚本中找到startLoading()方法.此方法在内部调用loadEditRequestPage()方法.找到loadEditRequestPage()方法.
  3. 此方法会将默认阶段(即阶段1)添加到批准工作流程中.我们需要在此处执行自动添加批准者的操作.
  4. 在代码中找到行requestDs.relations.WorkflowStages.createItem,此行是向工作流添加阶段.因此,我们需要多次添加此行以添加多个阶段.在下面的代码中,我将案例分为两个阶段.

用于在每个阶段添加2个阶段和1个批准者的代码.

if (requestDs.item.WorkflowStages.length === 0) {

    requestDs.relations.WorkflowStages.createItem(function() {
    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() {
    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();

    }); 

}

  1. 在上面的代码中,我在requestDs.relations.WorkflowStages.createItem调用中添加了行,此调用创建了一个阶段,在该阶段中,我通过创建新批准者数据源添加了预定义批准者.

仍然可以更改此代码以合并诸如用户的缩略图"之类的更改以及其他一些更改,但这将帮助您继续前进.根据需要添加/更改代码.

I use document approval template, and I want to define default approver and stages.

I have tried to change the custom value associates to the userpicker widget in EditRequest Page to define a default Approver by changing the location from onValueChange to onAttach. I set default value for mail's approvers.

PageEditRequest/userPickerWidget:

Function associates to the custom value of userPickerWidget:

But I don't know how can I associate a new stage to an another approver...

I tried a lot of things that failed

Have you any ideas?

I want to have this type of results without any client interaction:

Desired result:

解决方案

The earlier answer points to solve the problem where user are adding stage manually. If you want all stages and all approvers list to be added automatically, follow the below steps.

  1. Open Edit Request page, in that page you can find event onAttach, this event will trigger when page is being loaded and data has not loaded yet. DMS Template has already provided a method called startLoading() to this Event.
  2. Locate startLoading() method in Client Script named EditRequestPage_Request. This method is calling loadEditRequestPage() method internally. Locate loadEditRequestPage() method.
  3. This method is adding a default stage (i.e. Stage 1) to the approval workflow. We need to perform our operations here for Automatically add approvers.
  4. Locate the line requestDs.relations.WorkflowStages.createItem in the code, this line is Adding a Stage to the workflow. So we need to add this line multiple times to Add multiple stages. In my below code I've show cased for 2 stages.

Code for adding 2 stages and 1 approver at each stage.

if (requestDs.item.WorkflowStages.length === 0) {

    requestDs.relations.WorkflowStages.createItem(function() {
    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() {
    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();

    }); 

}

  1. In the above code I've added lines inside requestDs.relations.WorkflowStages.createItem call, this call is creating a stage, inside a stage I've added Predefined Approver by Creating New Approver Data source.

This code still can be changed for incorporating changes like User's Thumbnail and some other changes, but this will help you get going. Add/Change code as per need.

这篇关于App Maker文档批准模板:如何添加默认批准者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆