Hi Team,
In PurchLine, when we creating a new line on click on addlines. For example - we created a 5 lines
Then we put Item id , Config Id and then move to another line.
When we move to another line , I like to insert the PurchLine record to our custom table.
I wrote below code
Form - PurchTable -- Data source - PurchLine --- Events -- OnCreated
[FormDataSourceEventHandler(formDataSourceStr(PurchTable, PurchLine), FormDataSourceEventType::Created)] public static void PurchLine_OnCreated(FormDataSource sender, FormDataSourceEventArgs e) { PurchQtyTracking purchQtyTracking; PurchLineTracking purchLineTracking; PurchParameters purchParameters; FormRun formRun = sender.formRun(); FormDataSource purchLine_ds = formRun.dataSource(formDataSourceStr(PurchTable,PurchLine)) as FormDataSource; PurchLine purchLine = purchLine_ds.cursor(); purchParameters = PurchParameters::find(); // If the parameter is set to YES then always the PURCH QTY should be default to make zero. if (purchParameters.QtyZeroPOLines == NoYes::Yes) { // to insert the current record only with default Purct Qty = 0 for any item, If the parameter set to Yes ttsbegin; purchQtyTracking.PurchId = purchLine.PurchId; purchQtyTracking.ItemId = purchLine.ItemId; purchQtyTracking.ConfigId = InventDim::find(purchLine.InventDimId).configId; purchQtyTracking.RefRecId = purchLine.RecId; purchQtyTracking.PurchQty = 0; purchQtyTracking.doInsert(); ttscommit; } }
When I move to another line (without CTRL _S) the OnCreated events is NOT getting called
So, unable to get the table buffer here and It will insert blank line in my custom table.
I refereed few blogs, and the code for sender is different in different blogs.
Kindly verify my code pls. If anything need to change kindly guide me what to modify.
Is I am into correct event?
Pls give me more shed on this.
Thanks!