I want two custom fields from Purchase Receipts (PR) to copy their data into two correlated custom fields on Receipts when the PR is released.
Both fields on both forms are simple TextEdit fields.
I am trying to adapt the pseudocode from this post:
This is the error I keep getting:

Here is my code so far, my annotations might not be accurate:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PX.Common;
using PX.Data;
using PX.Data.BQL.Fluent;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.GL;
using PX.Objects;
using PX.Objects.IN;
using PX.Objects.PO;
namespace PX.Objects
{
public class INReceiptEntry_Extension : PXGraphExtension<PX.Objects.IN.INReceiptEntry>
{
#region Event Handlers
public PXSelect<POReceipt, Where<INRegister.docType, Equal<Current<POReceipt.receiptType>>, And<INRegister.refNbr, Equal<Current<POReceipt.inventoryRefNbr>>>>> correlatedReceipt;
protected void INTran_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
{
//this code is meant to populate the Vendor Lot/Serial custom fields of Receipts with the Vendor Lot/Serial custom fields of a released Purchase Receipt
/*pseudocode:
If POReceiptType, POReceiptNbr have a value
Parse through the correlated receipt found from a BQL query
Copy the values between the two forms, exclusivize assignment of values based on split vs. non-split.*/
var rowPR = (POReceipt)e.Row;//find current POReceipt record's header for ReceiptType and ReceiptNbr
var rowPRDetails = (POReceiptLineExt)e.Row;//find current POReceipt record's header for UsrPR_VendorLotSerialNbr
var rowPRSplit = (POReceiptLineSplitExt)e.Row;//find current POReceipt record's header for UsrPR_SplitVendorLotSerialNbr
var rowReceipt = (INRegister)e.Row;//find current Receipt record's header for DocType and RefNbr
var rowReceiptDetails = (INTran)e.Row;//find current Receipt record's header for UsrVendorLotSerialNbr
var rowReceiptSplit = (INTranSplit)e.Row;//find current Receipt record's split for UsrSplitVendorLotSerialNbr
if (rowPR == null || rowPRDetails == null || rowPRSplit == null) return;
//need two extensions variables. One for the main detail line and one for the row splits.
INTran standardReceiptItem = (INTran)Base.transactions.Current;
var standardReceiptExtVarRow = PXCache<INTran>.GetExtension<INTranExt>(standardReceiptItem );
var standardReceiptExtVarSplit = PXCache<INTranSplit>.GetExtension<INTranSplitExt>(standardReceiptItem );
/*POReceiptLine purchaseReceiptItem = POReceiptLine.transactions.Current;
var purchaseReceiptExtVarRow = PXCache<POReceiptLine>.GetExtension<POReceiptLineExt>(purchaseReceiptItem);
var purchaseReceiptExtVarSplit = PXCache<POReceiptLineSplit>.GetExtension<POReceiptLineSplitExt>(purchaseReceiptItem);*/
if (rowPR.ReceiptType != null && rowPR.ReceiptNbr != null)
{
//string standardReceiptRowVendorLot = rowPRDetails.UsrPR_VendorLotSerialNbr.ToString();
foreach (POReceipt item in correlatedReceipt.Select() )//parse through the BQL query (View) result
{
if (rowPRSplit.UsrPR_SplitVendorLotSerialNbr != null)
{
//standardReceiptExtVarSplit.UsrSplitVendorLotSerialNbr = rowPRSplit.UsrPR_SplitVendorLotSerialNbr.ToString();
cache.SetValueExt<INTranSplitExt.usrSplitVendorLotSerialNbr>(rowReceiptSplit, rowPRSplit.UsrPR_SplitVendorLotSerialNbr.ToString());
standardReceiptExtVarRow.UsrVendorLotSerialNbr = "<SPLIT>";
}else{
//standardReceiptExtVarRow.UsrVendorLotSerialNbr = rowPRDetails.UsrPR_VendorLotSerialNbr.ToString();
cache.SetValueExt<INTranExt.usrVendorLotSerialNbr>(rowReceiptDetails, rowPRDetails.UsrPR_VendorLotSerialNbr.ToString());
}
}
}
}
#endregion
}
}