Skip to main content
Solved

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


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.

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

2 replies

praveenpo
Semi-Pro II
Forum|alt.badge.img+3
  • Semi-Pro II
  • 99 replies
  • 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
  • 4 replies
  • October 5, 2023

Thanks very much !!


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