Skip to main content
Answer

Carry record note from Weekly Crew Time Entry to Employee time card

  • October 4, 2023
  • 2 replies
  • 81 views

Hi Community,

How can I make the records notes entered from the “Weekly crew time entry” be updated to the “Employee's time card” when they are created?

 

Best answer by praveenpo

hi @SulayVargas51 ,

We had similar kind of implementation where we are copying soline notes to shipment line.
you can refer the below sample code and implement in your graph.

public delegate void CreateShipmentDelegate(CreateShipmentArgs args);
        [PXOverride]
        public virtual void CreateShipment(CreateShipmentArgs args, CreateShipmentDelegate baseMethod)
        {
            baseMethod(args);
            SOOrder orderData = args.Order;
            if (orderData != null)
            {
                SOOrderEntry soGraph = PXGraph.CreateInstance<SOOrderEntry>();

 

                foreach (SOShipLine line in Base.Transactions.Select())
                {
                    SOLine objLine = PXSelect<SOLine, Where<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>,
                                                  And<SOLine.orderType, Equal<Required<SOLine.orderType>>,
                                                  And<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>,
                                                  And<SOLine.lineNbr, Equal<Required<SOLine.lineNbr>>>>>>>
                                                 .Select(Base, line.OrigOrderNbr, line.OrigOrderType, line.InventoryID, line.LineNbr);
                    if (objLine != null)
                    {
                        soGraph.Transactions.Current = objLine;
                        PXNoteAttribute.SetNote(Base.Transactions.Cache, line, PXNoteAttribute.GetNote(soGraph.Transactions.Cache, soGraph.Transactions.Current));
                        Base.Transactions.Cache.Update(line);
                    }
                }
                Base.Actions.PressSave();
            }
        }


Hope this is Helpful.

2 replies

praveenpo
Semi-Pro III
Forum|alt.badge.img+3
  • Semi-Pro III
  • Answer
  • October 5, 2023

hi @SulayVargas51 ,

We had similar kind of implementation where we are copying soline notes to shipment line.
you can refer the below sample code and implement in your graph.

public delegate void CreateShipmentDelegate(CreateShipmentArgs args);
        [PXOverride]
        public virtual void CreateShipment(CreateShipmentArgs args, CreateShipmentDelegate baseMethod)
        {
            baseMethod(args);
            SOOrder orderData = args.Order;
            if (orderData != null)
            {
                SOOrderEntry soGraph = PXGraph.CreateInstance<SOOrderEntry>();

 

                foreach (SOShipLine line in Base.Transactions.Select())
                {
                    SOLine objLine = PXSelect<SOLine, Where<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>,
                                                  And<SOLine.orderType, Equal<Required<SOLine.orderType>>,
                                                  And<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>,
                                                  And<SOLine.lineNbr, Equal<Required<SOLine.lineNbr>>>>>>>
                                                 .Select(Base, line.OrigOrderNbr, line.OrigOrderType, line.InventoryID, line.LineNbr);
                    if (objLine != null)
                    {
                        soGraph.Transactions.Current = objLine;
                        PXNoteAttribute.SetNote(Base.Transactions.Cache, line, PXNoteAttribute.GetNote(soGraph.Transactions.Cache, soGraph.Transactions.Current));
                        Base.Transactions.Cache.Update(line);
                    }
                }
                Base.Actions.PressSave();
            }
        }


Hope this is Helpful.


  • Author
  • Freshman I
  • October 5, 2023

Thanks very much !!