Skip to main content
Solved

Unable to bind new value to exisitng action filter dac on process shipment


Hello 

I am Currently Customizing the Process Shipment screen and I want to add new value Print packing Slip to the existing, process shipment screen. 


I was able to add the new value via, the customization package.


However, when I run my code, via extending the process shipment graph, I do not see the selected value.


 The goal I am trying to achieve , here is I want to run a report ( Shipment packing slip) via the process shipment screen. I have the report code working. All I want to do is , call this report via dropdown on the process shipment Action filter. 


        public PXAction<SOShipment> printPackingSlip;
        [PXButton(CommitChanges = true)]
        [PXUIField(DisplayName = "Print Packing Slip", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
        public virtual IEnumerable PrintPackingSlip(PXAdapter adapter)
        {
            return Base.Report(adapter.Apply(delegate (PXAdapter it)
            {
                it.Menu = "Print Packing Slip";
            }), "SO6420PS");
        }

Could anyone please suggest, the correct approach to add new value and append it to the existing drop-down on process shipment.





 
 

Best answer by darylbowman

You need to extend the workflow definition for that screen to include your new action.

 

Here is sample code that I used in a similar situation:

using System;
using PX.Data;
using PX.Data.WorkflowAPI;
using PX.Objects.IN;
using PX.Objects.SO;

namespace PrintInventoryLabels
{
    using static PX.Data.WorkflowAPI.BoundedTo<SOShipmentEntry, SOShipment>;

    public class PrintInventoryLabels_SOShipmentEntry_WorkflowExt : PXGraphExtension<PX.Objects.SO.SOShipmentEntry_Workflow, SOShipmentEntry>
    {
        public override void Configure(PXScreenConfiguration config) =>
            Configure(config.GetScreenConfigurationContext<SOShipmentEntry, SOShipment>());

        protected virtual void Configure(WorkflowContext<SOShipmentEntry, SOShipment> context)
        {
            #region Custom Actions

            var actionPrintInventoryLabels = context.ActionDefinitions.CreateExisting<PrintInventoryLabels_SOShipmentEntry_Extension>(g => g.PrintInventoryLabels, a => a
                .DisplayName("Print Inventory Labels")
                .WithCategory(printingAndEmailingCategory)
                .WithPersistOptions(ActionPersistOptions.PersistBeforeAction)
                .MassProcessingScreen<SOInvoiceShipment>()
                .MapEnableToUpdate()
            );

            #endregion

            context.UpdateScreenConfigurationFor(screen =>
            {
                return screen
                    .WithActions(actions =>
                    {
                        actions.Add(actionPrintInventoryLabels);
                    });
            });
        }
    }
}

 

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

3 replies

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1688 replies
  • Answer
  • August 1, 2023

You need to extend the workflow definition for that screen to include your new action.

 

Here is sample code that I used in a similar situation:

using System;
using PX.Data;
using PX.Data.WorkflowAPI;
using PX.Objects.IN;
using PX.Objects.SO;

namespace PrintInventoryLabels
{
    using static PX.Data.WorkflowAPI.BoundedTo<SOShipmentEntry, SOShipment>;

    public class PrintInventoryLabels_SOShipmentEntry_WorkflowExt : PXGraphExtension<PX.Objects.SO.SOShipmentEntry_Workflow, SOShipmentEntry>
    {
        public override void Configure(PXScreenConfiguration config) =>
            Configure(config.GetScreenConfigurationContext<SOShipmentEntry, SOShipment>());

        protected virtual void Configure(WorkflowContext<SOShipmentEntry, SOShipment> context)
        {
            #region Custom Actions

            var actionPrintInventoryLabels = context.ActionDefinitions.CreateExisting<PrintInventoryLabels_SOShipmentEntry_Extension>(g => g.PrintInventoryLabels, a => a
                .DisplayName("Print Inventory Labels")
                .WithCategory(printingAndEmailingCategory)
                .WithPersistOptions(ActionPersistOptions.PersistBeforeAction)
                .MassProcessingScreen<SOInvoiceShipment>()
                .MapEnableToUpdate()
            );

            #endregion

            context.UpdateScreenConfigurationFor(screen =>
            {
                return screen
                    .WithActions(actions =>
                    {
                        actions.Add(actionPrintInventoryLabels);
                    });
            });
        }
    }
}

 


  • Author
  • Freshman II
  • 7 replies
  • August 3, 2023

Hi @darylbowman I am not able to extend the work flow definition for that screen.

 



 

    public class SOInvoiceShipment_Workflow_Extension : PXGraph<SOInvoiceShipment>
    {
        public static bool IsActive() => true;
        public override void Configure(PXScreenConfiguration config) => 
            Configure(config.GetScreenConfigurationContext<SOInvoiceShipment, SOInvoiceShipment>());
        

        protected virtual void Configure(WorkflowContext<SOInvoiceShipment, SOInvoiceShipment> context)
        {

        }
    }

 


Do I need to extend the SOshipmentEntry Instead?
Could you please elaborate on how were you able to extend the work flow definition for the process shipment screen? 

Thank you


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

Yes, you should be extending SOShipmentEntry. This basically maps an action to a processing screen, which makes it available to mass process on that screen. This can also be done through the visual workflow, but I prefer code.


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