Hi All,
As per my requirement, When we create a lines on Purchase Order, at the same time I like to insert the same line on my Custom table.
Say for example - I have Purchase Order - P001 and I have created 5 lines
So, i like to insert those 5 lines in my custom table. but for me it is inserted only the last line when I finally click CTRL S once.
I wrote below code, Can anyone pls verify where is wrong? why it is NOT inserted all he lines in my custom table ?
class PurchLineOnInsertingEventHandler
{
///
///
///
///
///
[DataEventHandler(tableStr(PurchLine), DataEventType::Inserting)]
public static void PurchLine_onInserting(Common sender, DataEventArgs e)
{
PurchLine purchLine = sender as PurchLine;
PurchQtyTracking purchQtyTracking;
PurchParameters purchParameters;
purchParameters = PurchParameters::find();
if (purchParameters.QtyZeroPOLines == NoYes::Yes)
{
// to insert the current record only
ttsbegin;
purchQtyTracking.PurchId = purchLine.PurchId;
purchQtyTracking.ItemId = purchLine.ItemId;
purchQtyTracking.RefRecId = purchLine.RecId;
purchQtyTracking.doInsert();
ttscommit;
}
}
}
Pls give me more shed on this.
thanks!