Solved

UDFs from Purchase Receipt (PO302000) not refleced in IN Receipt (IN301000)


I've created UDFs to track MAC Address, IP Address, and Room Number related to stock inventory items within the PO302000 form.  I created the same in the IN301000 form.  I also modified the workflow within each of those to allow those fields to be modifiable regardless of the status of the documents.  All of that has worked.  For the most part, simple stuff to this point (I think!).  Now I am attempting to process a PO -> POR -> Inventory Receipt.  The UDF data entered within the line details of the POR is not carrying forward to the Inventory Receipt form where I hoped/thought it would display in the line details as well.  Can anyone help me understand what I'm missing.  If you've not seen any of my other topics, I am not a developer by trade, but I am gaining my knowledge of Acumatica customizations through trial and error (and Community help!) as I go.  Acumatica 2022 R2, Build 22.205.0026

icon

Best answer by Vignesh Ponnusamy 18 August 2023, 20:18

View original

12 replies

Userlevel 7
Badge +4

Hi @mrhoades,

It’s amazing hear you find the community helpful.!

To copy the UDF from PO302000 to IN301000, you might have to do a bit of coding. As you might have noticed, the IN Receipt is copied when we release the Purchase Receipt. Below is a graph extension you can try to copy the UDF from PO302000 to IN301000.

In the below example, I am copying AMBATLEN attribute during the Release process. Similarly you can copy one or more UDFs,

    public class POReceiptEntry_Extension : PXGraphExtension<PX.Objects.PO.POReceiptEntry>
{
#region Event Handlers
public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
PXGraph.InstanceCreated.AddHandler<INReceiptEntry>((graphINReceiptEntry) =>
{
graphINReceiptEntry.RowPersisting.AddHandler<INRegister>((sender, e) =>
{
INRegister currentINRegister = (INRegister)e.Row;
var AttributeAMBATLEN = Base.Document.Cache.GetValueExt(Base.Document.Current, "AttributeAMBATLEN");
graphINReceiptEntry.receipt.Cache.SetValueExt(currentINRegister, "AttributeAMBATLEN", AttributeAMBATLEN.ToString());

});
});
return baseMethod(adapter);
}
#endregion
}

Feel free to post if you have any questions.

Good Luck.!

Vignesh,

 

My fields are “customized” fields (Add Data Fields Tab) created within PO302000.  The first set are found in PO302000, Grid: Transactions:

Room Number (PO Recpt MainGrid); MAC Address (PO Recpt MainGrid); and IP Address (PO Recept MainGrid)

 

The second set are found in PO302000, Dialogs, Dialog: Line Details, Grid: splits:

Room Number (PO Recpt LnDet Split); MAC Address (PO Recpt LnDet Split); and IP Address (PO Recpt LnDet Split)

 

I’ve attached an export of my project for your review.  I appreciate your attempt to help.  From my reading and understanding, these data fields are not contained within the ATTRIBUTE table, which I believe is part of the code your provided.  We did not create attributes because I’m not sure how I would iterate those through the Line Details Split.  Thanks for any additional help/insight you can provide.


Michael

 

 

Userlevel 7
Badge +4

@mrhoades,

Thanks for the clarification.

In that case, to display the custom fields in the IN301000 screen detail line, you have to create custom fields respectively in INTrac DAC. Then like below you need to copy the field from POReceiptLine to INTran,

        public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
PXGraph.InstanceCreated.AddHandler<INReceiptEntry>((graphINReceiptEntry) =>
{
graphINReceiptEntry.RowPersisting.AddHandler<INTran>((sender, e) =>
{
INTran currentINTran = (INTran)e.Row;
INTranExt TranExt = PXCache<INTran>.GetExtension<INTranExt>(currentINTran);
POReceiptLine currentPOReceiptLine = PXSelect<POReceiptLine, Where<POReceiptLine.receiptNbr,
Equal<Required<POReceiptLine.receiptNbr>>, And<POReceiptLine.lineNbr,
Equal<Required<POReceiptLine.lineNbr>>>>>.Select(Base, currentINTran.POReceiptNbr,currentINTran.POReceiptLineNbr );
POReceiptLineExt ReceiptLineExt = Base.transactions.Cache.GetExtension<POReceiptLineExt>(currentPOReceiptLine);
TranExt.UsrPORecptMainGridRoomNbr = ReceiptLineExt.UsrPORecptMainGridRoomNbr;
TranExt.UsrPORecptMainGridMACAdd = ReceiptLineExt.UsrPORecptMainGridMACAdd;
TranExt.UsrPORecptMainGridIPAddress = ReceiptLineExt.UsrPORecptMainGridIPAddress;
});
});
return baseMethod(adapter);
}

 

I have also attached the updated customization custom fields and the Release override to copy them to the IN301000 fields. You can test the update package and use it as reference, 

Hope that helps.! Good Luck,

I figured it was the same process, just needed the additional info on where!  I’ll try this and get back to you.  I appreciate your very quick response.

 

Yours,

Michael

Vignesh – I’ve taken the information you provided and attempted to build upon it.  However, like I’ve mentioned – I am not a Developer by training or trade.  Therefore, although I believe I am making progress and learning as I go, I am currently receiving an error message when I process a Purchase Order.  Here is what I see:

  • Create a PO (PO301000) – No Problem
  • Release PO -> Purchase Receipt created.  Details entered in Main Grid using an inventory item that is a Serial Number Required type.  Qty of 2.  Lot/Serial Nbr shows <SPLIT>.  Enter Line Details for SPLIT.  No problem here either.  The workflow modification for the Custom Fields performs as desired.  From Balanced status, I try to RELEASE the POR.
  • Upon RELEASE of the PO Receipt, I receive this error: “Unable to cast object of type ‘PX.Objects.IN.INTran’ to type ‘PX.Objects.IN.INTranSplit’

In the project you provided, the IN.INTran Custom fields were included.  I’ve added the IN.INTranSplit Custom fields following your example for those used in IN.INTran by the POReceiptEntry graph.  I’ve attempted to add the additional code for IN.INTranSplit as well.  Although the graph does VALIDATE and PUBLISH, the error is thrown.  Not sure what I’m missing.  I’ve commented the code so you can see where I’ve inserted additional lines to try and get the POR Line Split Detail Custom Fields to populate the IN.INTranSplit Custom Fields.  I’ve actually tried many variations trying to figure the issue out myself.  Just not successful yet.

Exported my Project File and attached for your review/suggestions.  Thank you in advance for any help you can provide.

Userlevel 7
Badge +4

Hi @mrhoades,

Kindly try something like below,

        public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
PXGraph.InstanceCreated.AddHandler<INReceiptEntry>((graphINReceiptEntry) =>
{
graphINReceiptEntry.RowPersisting.AddHandler<INTranSplit>((sender, e) =>
{
INTranSplit currentINTranSplit = (INTranSplit)e.Row;
INTranSplitExt TranSplitExt = PXCache<INTranSplit>.GetExtension<INTranSplitExt>(currentINTranSplit);
POReceiptLineSplit currentPOReceiptLineSplit = PXSelect<POReceiptLineSplit, Where<POReceiptLineSplit.receiptNbr,
Equal<Required<POReceiptLineSplit.receiptNbr>>,
And<POReceiptLineSplit.receiptType,
Equal<Required<POReceiptLineSplit.receiptType>>,
And<POReceiptLineSplit.inventoryID, Equal<Required<POReceiptLineSplit.inventoryID>>,
And<POReceiptLineSplit.qty, Equal<Required<POReceiptLineSplit.qty>>
>>>>>.Select(Base, graphINReceiptEntry.receipt.Current.POReceiptNbr,
graphINReceiptEntry.receipt.Current.POReceiptType, currentINTranSplit.InventoryID,
currentINTranSplit.Qty); //Query to Get the mathcing POReceiptLineSplit. Kindly add or remove conditions as required
POReceiptLineSplitExt ReceiptLineSplitExt = PXCache<POReceiptLineSplit>.GetExtension<POReceiptLineSplitExt>(currentPOReceiptLineSplit);
//POReceiptLineSplitExt ReceiptLineSplitExt = Base.transactions.Cache.GetExtension<POReceiptLineSplitExt>(currentPOReceiptLineSplit);
TranSplitExt.UsrPORecptLnDetSplitRoomNbr = ReceiptLineSplitExt.UsrPORecptLnDetSplitRoomNbr;
TranSplitExt.UsrPORecptLnDetSplitMACAdd = ReceiptLineSplitExt.UsrPORecptLnDetSplitMACAdd;
TranSplitExt.UsrPOReceptLnDetSplitIPAdd = ReceiptLineSplitExt.UsrPORecptLnDetSplitIPAdd;
/* END Mike attempt to add the other Custom User Fields for INTranSplit */
});
});
return baseMethod(adapter);
}

Hope that helps.! Good Luck.!

I appreciate your response.  I’ll modify my project and see if I can move it forward.

Vignesh,

I’ve been banging my head on the wall trying to get both pieces of the INTran and INTranSplit to copy the data for my custom fields from the PO Receipt to the INReceipt.  Each piece will work independently.  However, none of my attempts to combine both to a single graph work.  I constantly receive an “ Unable to cast object of type 'PX.Objects.IN.INTran' to type 'PX.Objects.IN.INTranSplit' error.  Can you review the attached and tell me what you see that I’m doing wrong.  Again, newbee to C# and trying to get some work done and learn at same time.

 

namespace PX.Objects.PO
{
    public class POReceiptEntry_Extension : PXGraphExtension<PX.Objects.PO.POReceiptEntry>
    {
        #region Event Handlers
        protected void POReceiptLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
        {
            baseHandler?.Invoke(cache, e);
            var row = (POReceiptLine)e.Row;
            if (row != null)
            {
                Base.Document.Cache.AllowUpdate = true;
                cache.AllowUpdate = true;
                /* My Custom User fields for the PO Receipt Main Grid */
                PXUIFieldAttribute.SetEnabled<POReceiptLineExt.usrPORecptMainGridRoomNbr>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineExt.usrPORecptMainGridMACAdd>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineExt.usrPORecptMainGridIPAddress>(cache, row, true);
            }
        }
        protected void POReceiptLineSplit_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
        {
            baseHandler?.Invoke(cache, e);
            var row = (POReceiptLineSplit)e.Row;
            if (row != null)
            {
                Base.Document.Cache.AllowUpdate = true;
                cache.AllowUpdate = true;
                /* My Custom User Defined fields for the PO Receipt Line Details (Split) Grid */
                PXUIFieldAttribute.SetEnabled<POReceiptLineSplitExt.usrPORecptLnDetSplitRoomNbr>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineSplitExt.usrPORecptLnDetSplitMACAdd>(cache, row, true);
                PXUIFieldAttribute.SetEnabled<POReceiptLineSplitExt.usrPORecptLnDetSplitIPAdd>(cache, row, true);
            }
        }

/*     BEGIN Inserting INTran and INTranSplit graph here. This will validate and publish without errors.              */
        public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
        [PXOverride]
        public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
        {
            PXGraph.InstanceCreated.AddHandler<INReceiptEntry>((graphINReceiptEntry) =>
          {
                 graphINReceiptEntry.RowPersisting.AddHandler<INTran>((sender, e) =>
             {
                    INTran currentINTran = (INTran)e.Row;
                    INTranExt TranExt = PXCache<INTran>.GetExtension<INTranExt>(currentINTran);
                    POReceiptLine currentPOReceiptLine = PXSelect<POReceiptLine, Where<POReceiptLine.receiptNbr,
                        Equal<Required<POReceiptLine.receiptNbr>>, And<POReceiptLine.lineNbr,
                        Equal<Required<POReceiptLine.lineNbr>>>>>.Select(Base, currentINTran.POReceiptNbr,currentINTran.POReceiptLineNbr );
                    POReceiptLineExt ReceiptLineExt = Base.transactions.Cache.GetExtension<POReceiptLineExt>(currentPOReceiptLine);
                    TranExt.UsrPORecptMainGridRoomNbr = ReceiptLineExt.UsrPORecptMainGridRoomNbr;
                    TranExt.UsrPORecptMainGridMACAdd = ReceiptLineExt.UsrPORecptMainGridMACAdd;
                    TranExt.UsrPORecptMainGridIPAddress = ReceiptLineExt.UsrPORecptMainGridIPAddress;
                    INTranSplit currentINTranSplit = (INTranSplit)e.Row;
                    INTranSplitExt TranSplitExt = PXCache<INTranSplit>.GetExtension<INTranSplitExt>(currentINTranSplit);
                    POReceiptLineSplit currentPOReceiptLineSplit = PXSelect<POReceiptLineSplit, Where<POReceiptLineSplit.receiptNbr,
                        Equal<Required<POReceiptLineSplit.receiptNbr>>,
                        And<POReceiptLineSplit.receiptType,
                        Equal<Required<POReceiptLineSplit.receiptType>>,
                        And<POReceiptLineSplit.inventoryID, Equal<Required<POReceiptLineSplit.inventoryID>>,
                        And<POReceiptLineSplit.qty, Equal<Required<POReceiptLineSplit.qty>>
                        >>>>>.Select(Base, graphINReceiptEntry.receipt.Current.POReceiptNbr,
                        graphINReceiptEntry.receipt.Current.POReceiptType, currentINTranSplit.InventoryID,
                        currentINTranSplit.Qty); //Query to Get the mathcing POReceiptLineSplit.
                    POReceiptLineSplitExt ReceiptLineSplitExt = PXCache<POReceiptLineSplit>.GetExtension<POReceiptLineSplitExt>(currentPOReceiptLineSplit);
                    TranSplitExt.UsrPORecptLnDetSplitRoomNbr = ReceiptLineSplitExt.UsrPORecptLnDetSplitRoomNbr;
                    TranSplitExt.UsrPORecptLnDetSplitMACAdd = ReceiptLineSplitExt.UsrPORecptLnDetSplitMACAdd;
                    TranSplitExt.UsrPOReceptLnDetSplitIPAdd = ReceiptLineSplitExt.UsrPORecptLnDetSplitIPAdd;
/*   END of attempt to get Custom Fields in Purchase Order Receipt Main Grid and Line Detail Split to cast to INReceipt Main Grid and Line Detail Split */
                });
              });
            return baseMethod(adapter);
        #endregion
        }
    }
}

 

Thanks,

Mike

Vignesh,

Would you be able to review my response about 10 days ago and provide your review?

Thanks,

Mike

Vignesh,

I figured out the issue causing the graph to fail.  I wanted to thank you for your time in responding.  I would not have been successful without your assistance.

 

Mike

Userlevel 7
Badge +4

@mrhoades, Nice to hear that, sorry I wasn’t able to get to you on this.

Good Luck.!

Vignesh,

I identified an issue I had missed.  Could you take a look at the attached notes w/screenshots and the  project file and let me know if you can point out the issue.

Simply put, when I create a PO and process through a RELEASED POR for an item that requires serial numbering, the POReceipt LineDetails (SPLIT) is not functioning correctly.  Although the Lot/Serial Number for each Line Detail (SPLIT) row is correctly copied to the INReceipt, the CUSTOM fields for Line1 of the Line Detail (SPLIT) are copied to Line2 and any subsequent line(s).

Your review and guidance would be greatly appreciated.

Michael

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