Solved

How to pass customized field values from Sales Header to shipment Header

  • 17 October 2023
  • 6 replies
  • 113 views

Userlevel 4
Badge

Hi Team,

How to pass customized field values from Sales Header to shipment Header?

Currently I overrided “CreateShipmentFromSchedules” to pass the customized field values from Sales Line to Shipment. But i cannot find a way to pass the values for headers.

Could you please help me on this.

Regards,

Ramya

icon

Best answer by Vignesh Ponnusamy 17 October 2023, 17:38

View original

6 replies

Userlevel 6
Badge +3

hi @ramya15,

You can copy the value from Sales order to shipment using PXDefault

Here is the sample for copying data from SOline to SOShipline..


#region UsrKNValue1
        [PXDBString(50, IsUnicode = true)]
        [PXDefault(typeof(Search<SOLineExt.usrKNValue1,
                              Where<SOLine.orderType, Equal<Current<SOShipLine.origOrderType>>,
                            And<SOLine.orderNbr, Equal<Current<SOShipLine.origOrderNbr>>,
                             And<SOLine.lineNbr, Equal<Current<SOShipLine.origLineNbr>>>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
        [PXUIField(DisplayName = "Value 1")]
        public string UsrKNValue1 { get; set; }
        public abstract class usrKNValue1 : PX.Data.BQL.BqlString.Field<usrKNValue1> { }
        #endregion
 

Hope this is helpful.

Userlevel 4
Badge

Hi @praveenpo,

I want to copy value from SOOrder to SOShipment. (Header to Header). Could you help me on this.

 

Regards,

Ramya 

Userlevel 6
Badge +3

Can you please share your SOORder and SOShipment  Extension DAC’s

 

Userlevel 4
Badge

@praveenpo ,

Please find below details.

 

namespace PX.Objects.SO
{
    public class SOOrderExt : PXCacheExtension<PX.Objects.SO.SOOrder>
    {

#region UsrSubConPoAmt
        [PXDBDecimal]
        [PXUIField(DisplayName = "^SubCon Po Amt")]
        public virtual Decimal? UsrSubConPoAmt { get; set; }
        public abstract class usrSubConPoAmt : PX.Data.BQL.BqlDecimal.Field<usrSubConPoAmt> { }
        #endregion

}

}

****************************************

namespace PX.Objects.SO
{
    public class SOShipmentExt : PXCacheExtension<PX.Objects.SO.SOShipment>
    {

#region UsrSubConPoAmt
        [PXDBDecimal]
        [PXUIField(DisplayName = "^SubCon Po Amt")]
        public virtual Decimal? UsrSubConPoAmt { get; set; }
        public abstract class usrSubConPoAmt : PX.Data.BQL.BqlDecimal.Field<usrSubConPoAmt> { }
        #endregion

}

}

 

 

Userlevel 7
Badge +4

Hi @ramya15,

You can override CreateShipment method in SOOrderEntry graph and add RowPersisting evenhandler to inject the custom value that you need to carry from the SO to Shipment screen.

Following is an example for your reference,

    public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{
#region Event Handlers
public delegate IEnumerable CreateShipmentDelegate(PXAdapter adapter, Nullable<DateTime> shipDate, Nullable<Int32> siteID, String operation);
[PXOverride]
public IEnumerable CreateShipment(PXAdapter adapter, Nullable<DateTime> shipDate, Nullable<Int32> siteID, String operation, CreateShipmentDelegate baseMethod)
{
PXGraph.InstanceCreated.AddHandler<SOShipmentEntry>((graphShipmentEntry) =>
{
graphShipmentEntry.RowPersisting.AddHandler<SOShipment>((sender, e) =>
{
SOShipment currentShipment = (SOShipment)e.Row;
SOShipmentExt currentShipmentExt = currentShipment.GetExtension<SOShipmentExt>();
SOOrderExt currentOrderExt = PXCache<SOOrder>.GetExtension<SOOrderExt>(Base.Document.Current);
currentShipmentExt.UsrSubConPoAmt = currentOrderExt.UsrSubConPoAmt;
var files = PXNoteAttribute.GetFileNotes(Base.Document.Cache, Base.Document.Current);
PXNoteAttribute.SetFileNotes(graphShipmentEntry.Document.Cache, graphShipmentEntry.Document.Current, files);
});
});
return baseMethod(adapter, shipDate, siteID, operation);
}
#endregion
}

 

Good Luck.!

Userlevel 4
Badge

Hi @Vignesh Ponnusamy ,

Thank you, I will try this.

 

Regards,

Ramya

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