How to Confirm the action clicked is the expected action when we add custom logic to existing actions

人盡茶涼 提交于 2019-12-13 07:46:16

问题


This is a continuation of this case

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);
         }

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?


回答1:


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);        
 }


来源:https://stackoverflow.com/questions/39261417/how-to-confirm-the-action-clicked-is-the-expected-action-when-we-add-custom-logi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!