Skip to main content
Question

SOShipmentEntry "ActionDelegate" methos removed in latest version

  • Mar 31, 2023 10:33 AM UTC
  • 6 replies
  • 99 views
  • Translate All

Forum|alt.badge.img

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

Forum|alt.badge.img+2
  • Acumatica Moderator
  • Mar 31, 2023 8:56 PM UTC

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.

Translate

Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • Apr 3, 2023 2:28 PM UTC

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

Translate

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • May 17, 2023 9:25 PM UTC

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

Translate

Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • Jul 5, 2023 9:43 AM UTC

Hi @Chris Hackett , @Cesar Betances 

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

 

Regards,

Ramya Krishna

Translate

Yuriy Zaletskyy
Jr Varsity II
Forum|alt.badge.img+4

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

Translate

Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • Jul 5, 2023 10:21 AM UTC

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

Translate