当我们向现有动作添加自定义逻辑时,如何确认单击的动作是预期的动作 [英] How to Confirm the action clicked is the expected action when we add custom logic to existing actions

查看:52
本文介绍了当我们向现有动作添加自定义逻辑时,如何确认单击的动作是预期的动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是此案例

我正在尝试向请求屏幕中的现有操作按钮添加自定义逻辑。我可以在批准按钮之前(或之后)看到批准按钮,我需要做一些自定义逻辑。

I am trying to add custom logic to an existing action button in requisition screen. I can see the approve button before (or may be after) it gets approved i need to do some custom logic.

在分析了当前图形之后,我得出了以下解决方案

After analyzing the current graph i came to the below solution

public PXAction<RQRequisition> action;
         [PXUIField(DisplayName = "Actions")]
         [PXButton]
         protected virtual IEnumerable Action(PXAdapter adapter,
         [PXInt]
        [PXIntList(new int[] { 1, 2 }, new string[] { "Approve", "Reject" })]
        int? actionID,
        [PXBool]
        bool refresh,
        [PXString]
        string actionName
        )
         {
             if (actionID == 1)
             {
                 SIApprovalInfo.updateNextApprover(this.Base);
             }
             return Base.action.Press(adapter);
         }

当我尝试访问操作名称时,它给了我null,所以我刚刚检查了actionID的值为1,因为传入的值为1。我注意到,在自动化屏幕中,用户可以对操作进行重新排序。所以我的问题是:如果用户对操作进行重新排序,则actionID仍将保持为1吗?如果不是,那么识别我们期望采取的行动的正确方法是什么?

When i try to access the action name, it is giving me null, so i just checked the actionID for 1 as the value coming is 1. I noticed that in the automation screen, user is able to re-order the actions. So my question is: if the user reorder the action will the actionID still remain as 1? if not, what is the correct way of identifying the action we are expecting?

推荐答案

经过几次检查,我发现表示批准或拒绝的操作ID为1
但是我可以使用adapter.Menu来检查名称。

After few checks, i found that the actionID is coming as 1 for Approve or Reject. But i can use adapter.Menu to check the name.

 if (adapter.Menu == "Approve")
 {
    SIApprovalInfo.updateNextApprover(this.Base);        
 }

这篇关于当我们向现有动作添加自定义逻辑时,如何确认单击的动作是预期的动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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