0

Is it possible to add custom actions to the mass actions dropdown on a generic inquiry? I created a custom "Approve" action for the vendor screen (AP.30.30.00) via workflows; however, it does not appear on the mass actions dropdown. Any help would be greatly appreciated.

Image 1

Image 2

I tried the following, but I kept getting an error.

using PX.Data;

namespace PX.Objects.AP
{
    public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
    {
        public override void Initialize()
        {
            Approve.IsMass = true;
        }

        public PXAction<Vendor> Approve;
        [PXButton]
        [PXUIField(DisplayName = "Approve")]
        public void Approve()
        {
            throw new PXException("Approve !");
        }
    }
}

1 Answer 1

0

Here is the modified version of your code, with this you will see your Approve action in the mass action dropdown. I modified the Approve function declaration, changed it's name to lowercase, and changed the action type to VendorR.

using System.Collections;
using PX.Data;
using PX.Objects.Common.Extensions;
using PX.Objects;
using PX.Objects.AP;

namespace PX.Objects.AP
{
     public class VendorMaint_Extension : PXGraphExtension<PX.Objects.AP.VendorMaint>
     {
          public override void Initialize()
          {
              Approve.IsMass = true;
              base.Initialize();
          }
      
          public PXAction<VendorR> Approve; // Type was wrong, you need to use VendorR
          [PXButton]
          [PXUIField(DisplayName = "Approve")]
          public virtual IEnumerable approve(PXAdapter adapter)
          {
              throw new PXException("Approve !");
              return adapter.Get();
          }
     }
}
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for helping, Zoltan. I tried using the updated code you provided, but the "Approve" action is still not appearing in the mass action dropdown. The button also stopped working, it only shows the PXException message "Approve !" when clicked. The "Approve" button should update the status on the vendor profile from "Pending Approval" to "Active."
I don't really understand you. There is nothing else in the code, just an exception. It won't update anything until you code it. I believe you need to remove all of your workflow and low code changes, and write everything in the approve() function. I tested my solution on 23R2 and I had the function in the mass action list in the GI. Have you tried to edit the GI and add this action, or you just checking in on the screen?
I was still having problems, but I was able to hijack the existing graph actions and change their behavior to update the vendor status. Since the actions were already in the system, I did not need to modify the code to get them to appear on the mass actions dropdown. Thank you for helping, I appreciate it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.