Question

SOShipmentEntry "ActionDelegate" methos removed in latest version

  • 31 March 2023
  • 6 replies
  • 54 views

Userlevel 4
Badge

Hi Team,

In version 2020R2 we have override the “ActionDelegate” method in SOShipmentEntry Graph. Now we are upgarding to version 2022R2. I could see this method is available in the latest.

Could you please let me know how i can resolve this.

 

Regards,

Ramya Krishna


6 replies

Userlevel 4
Badge +2

Hi @ramya15 ,

Could you provide more details about your requirement ?

As you already mentioned this Action method is no longer on 2022R2 due to the implementation of Workflows.

Userlevel 4
Badge

Hi @Cesar Betances,

My Requirement is to update two Customized fields, when “Print Pick List” action performed.

Below is 2022R2 Code for your reference. Kindly let me know how i can implement this in the Latest version.

 

 public delegate IEnumerable ActionDelegate(PXAdapter adapter, Nullable<Int32> actionID, String ActionDelegateName);
        [PXOverride]
        public IEnumerable Action(PXAdapter adapter, Nullable<Int32> actionID, String ActionName, ActionDelegate baseMethod)
        {
            CustomizationBasedOnTenant tenantInv = PXSelect<CustomizationBasedOnTenant,
                      Where<CustomizationBasedOnTenant.tenantID, Equal<Required<CustomizationBasedOnTenant.tenantID>>,
                  And<CustomizationBasedOnTenant.customizedExtScreen, Equal<Required<CustomizationBasedOnTenant.customizedExtScreen>>,
                  And<CustomizationBasedOnTenant.selector, NotEqual<Required<CustomizationBasedOnTenant.selector>>>>>>
                      .Select(Base, tenantID, CustSetup, true);

            if (tenantInv == null)
            {
                if (!string.IsNullOrEmpty(ActionName))
                {
                    PXAction action = Base.Actions[ActionName];

                    if (action != null)
                    {
                        Base.Save.Press();
                        List<object> result = new List<object>();
                        foreach (object data in action.Press(adapter))
                        {
                            result.Add(data);
                        }
                        return result;
                    }
                }

                List<SOShipment> list = new List<SOShipment>();
                foreach (SOShipment order in adapter.Get<SOShipment>())
                {
                    list.Add(order);
                }

                switch (actionID)
                {
                    case SOShipmentEntryActionsAttribute.PrintPickList:

                        if (Base.Document.Current != null)
                        {

                            var ship = Base.Document.Current;
                            var shipment = Base.Transactions.Select();

                            var shipExt = ship.GetExtension<SOShipmentExt>();

                            if (shipExt.UsrPrintCount.GetValueOrDefault(0) > 0)
                            {

                                WebDialogResult result = Base.Document.Ask(ActionsMessages.Warning, PXMessages.LocalizeFormatNoPrefix("Are you sure want to Reprint?"),
                                    MessageButtons.OKCancel, MessageIcon.Warning, true);
                                shipExt.UsrPrintCount = shipExt.UsrPrintCount + 1;
                                shipExt.UsrBarcodeLabel = true;
                                Base.Document.Cache.Update(shipExt);
                                Base.Document.Update(ship);

                                foreach (SOShipLine line in shipment)
                                {
                                    var lineExt = line.GetExtension<SOShipLineExt>();
                                    lineExt.UsrBarcodeLabel = true;
                                    Base.Transactions.Cache.Update(lineExt);
                                    Base.Transactions.Update(line);
                                }

                            }
                            else
                            {
                                shipExt.UsrPrintCount = 1;
                                shipExt.UsrBarcodeLabel = true;
                                Base.Document.Cache.Update(shipExt);
                                Base.Document.Update(ship);
                                foreach (SOShipLine line in shipment)
                                {
                                    var lineExt = line.GetExtension<SOShipLineExt>();
                                    lineExt.UsrBarcodeLabel = true;
                                    Base.Transactions.Cache.Update(lineExt);
                                    Base.Transactions.Update(line);
                                }
                            }
                            Base.Save.Press();
                        }

                        break;
                    default:
                        Base.Save.Press();
                        break;
                }
            }
            return baseMethod(adapter, actionID, ActionName);

        }
 

 

 

Regards,

Ramya Krishna

Userlevel 7
Badge

Hi @ramya15 were you able to find a solution? Thank you!

Userlevel 4
Badge

Hi @Chris Hackett , @Cesar Betances 

I’m unable to get solution for this, Please help me on this.

 

Regards,

Ramya Krishna

Userlevel 5
Badge +3

@ramya15 which screen, and what is caption of that action, that you try to override?

Userlevel 4
Badge

Hi @Yuriy Zaletskyy,

Changes is on “Shipment Screen SO302000”. Actually i’m updating 2 of my customized fields upon Standard “Print Pick List” action. Below is my code in 2020 R2 version, and currently upgrading this code to 2022 R2. Kindly help me on this.

 

Version 2020R2:

 public delegate IEnumerable ActionDelegate(PXAdapter adapter, Nullable<Int32> actionID, String ActionDelegateName);
        [PXOverride]
        public IEnumerable Action(PXAdapter adapter, Nullable<Int32> actionID, String ActionName, ActionDelegate baseMethod)
        {
            CustomizationBasedOnTenant tenantInv = PXSelect<CustomizationBasedOnTenant,
                      Where<CustomizationBasedOnTenant.tenantID, Equal<Required<CustomizationBasedOnTenant.tenantID>>,
                  And<CustomizationBasedOnTenant.customizedExtScreen, Equal<Required<CustomizationBasedOnTenant.customizedExtScreen>>,
                  And<CustomizationBasedOnTenant.selector, NotEqual<Required<CustomizationBasedOnTenant.selector>>>>>>
                      .Select(Base, tenantID, CustSetup, true);

            if (tenantInv == null)
            {
                if (!string.IsNullOrEmpty(ActionName))
                {
                    PXAction action = Base.Actions[ActionName];

                    if (action != null)
                    {
                        Base.Save.Press();
                        List<object> result = new List<object>();
                        foreach (object data in action.Press(adapter))
                        {
                            result.Add(data);
                        }
                        return result;
                    }
                }

                List<SOShipment> list = new List<SOShipment>();
                foreach (SOShipment order in adapter.Get<SOShipment>())
                {
                    list.Add(order);
                }

                switch (actionID)
                {
                    case SOShipmentEntryActionsAttribute.PrintPickList:

                        if (Base.Document.Current != null)
                        {

                            var ship = Base.Document.Current;
                            var shipment = Base.Transactions.Select();

                            var shipExt = ship.GetExtension<SOShipmentExt>();

                            if (shipExt.UsrPrintCount.GetValueOrDefault(0) > 0)
                            {

                                WebDialogResult result = Base.Document.Ask(ActionsMessages.Warning, PXMessages.LocalizeFormatNoPrefix("Are you sure want to Reprint?"),
                                    MessageButtons.OKCancel, MessageIcon.Warning, true);
                                shipExt.UsrPrintCount = shipExt.UsrPrintCount + 1;
                                shipExt.UsrBarcodeLabel = true;
                                Base.Document.Cache.Update(shipExt);
                                Base.Document.Update(ship);

                                foreach (SOShipLine line in shipment)
                                {
                                    var lineExt = line.GetExtension<SOShipLineExt>();
                                    lineExt.UsrBarcodeLabel = true;
                                    Base.Transactions.Cache.Update(lineExt);
                                    Base.Transactions.Update(line);
                                }

                            }
                            else
                            {
                                shipExt.UsrPrintCount = 1;
                                shipExt.UsrBarcodeLabel = true;
                                Base.Document.Cache.Update(shipExt);
                                Base.Document.Update(ship);
                                foreach (SOShipLine line in shipment)
                                {
                                    var lineExt = line.GetExtension<SOShipLineExt>();
                                    lineExt.UsrBarcodeLabel = true;
                                    Base.Transactions.Cache.Update(lineExt);
                                    Base.Transactions.Update(line);
                                }
                            }
                            Base.Save.Press();
                        }

                        break;
                    default:
                        Base.Save.Press();
                        break;
                }
            }
            return baseMethod(adapter, actionID, ActionName);

        }

Regards,

Ramya Krishna

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved