Skip to main content
Solved

How to add custom Action Buttons into GI Mass Action

  • January 19, 2023
  • 2 replies
  • 729 views

 Hello,

I made a Custom Screen that has two Action Buttons

I want that these Action Buttons appear into my GI screen in Mass Actions but I dont know how

 

 

Both buttons have the same structure

#region Actions
        public PXAction<USRCBVCVacations> Approve;
        [PXButton(CommitChanges = true, Category = "Processing")]
        [PXUIField(DisplayName = "Approve")]
        protected virtual IEnumerable approve(PXAdapter adapter)
        {
            USRCBVCVacations vacations = Vacation.Current;

            USRCBVCVacationsEntry graph = PXGraph.CreateInstance<USRCBVCVacationsEntry>();

            PXLongOperation.StartOperation(this, delegate ()
            {
                vacations.Status = Vacations.Helper.Constants.Status.Approved;
                graph.Vacation.Update(vacations);
                graph.Actions.PressSave();

            });

            return adapter.Get();
        }
 #endregion

 

Best answer by davidnavasardyan

try to create a constructor. Inside this constructor, set the property 'IsMass' to 'true' for the action. It should look something like this.

 

    public class USRCBVCVacationsEntry : PXGraph<USRCBVCVacationsEntry>
    {
        #region Selects
        public PXSelect<USRCBVCVacations> Vacation;
        #endregion

        #region ctor
        public USRCBVCVacationsEntry()
        {
            Approve.IsMass = true; // <-
        }
        #endregion

        #region Actions
        public PXAction<USRCBVCVacations> Approve;
        [PXButton(CommitChanges = true, Category = "Processing")]
        [PXUIField(DisplayName = "Approve")]
        protected virtual IEnumerable approve(PXAdapter adapter)
        {
            USRCBVCVacations vacations = Vacation.Current;

            USRCBVCVacationsEntry graph = PXGraph.CreateInstance<USRCBVCVacationsEntry>();

            PXLongOperation.StartOperation(this, delegate ()
            {
                vacations.Status = Vacations.Helper.Constants.Status.Approved;
                graph.Vacation.Update(vacations);
                graph.Actions.PressSave();

            });

            return adapter.Get();
        }
        #endregion
    }

 

View original
Did this topic help you find an answer to your question?

2 replies

davidnavasardyan
Jr Varsity I
Forum|alt.badge.img+2

try to create a constructor. Inside this constructor, set the property 'IsMass' to 'true' for the action. It should look something like this.

 

    public class USRCBVCVacationsEntry : PXGraph<USRCBVCVacationsEntry>
    {
        #region Selects
        public PXSelect<USRCBVCVacations> Vacation;
        #endregion

        #region ctor
        public USRCBVCVacationsEntry()
        {
            Approve.IsMass = true; // <-
        }
        #endregion

        #region Actions
        public PXAction<USRCBVCVacations> Approve;
        [PXButton(CommitChanges = true, Category = "Processing")]
        [PXUIField(DisplayName = "Approve")]
        protected virtual IEnumerable approve(PXAdapter adapter)
        {
            USRCBVCVacations vacations = Vacation.Current;

            USRCBVCVacationsEntry graph = PXGraph.CreateInstance<USRCBVCVacationsEntry>();

            PXLongOperation.StartOperation(this, delegate ()
            {
                vacations.Status = Vacations.Helper.Constants.Status.Approved;
                graph.Vacation.Update(vacations);
                graph.Actions.PressSave();

            });

            return adapter.Get();
        }
        #endregion
    }

 


darylbowman
Captain II
Forum|alt.badge.img+13

Try adding the [PXMassAction] attribute into the action definition:

 

public PXAction<USRCBVCVacations> Approve;
[PXButton(CommitChanges = true, Category = "Processing")]
[PXMassAction]
[PXUIField(DisplayName = "Approve")]
protected virtual IEnumerable approve(PXAdapter adapter)
{
	//...
}

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings