How to Confirm the action clicked is the expected

2019-09-13 18:51发布

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?

标签: acumatica
1条回答
来,给爷笑一个
2楼-- · 2019-09-13 18:59

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);        
 }
查看更多
登录 后发表回答