I'm trying to trigger some activity with a sales invoice by writing an onInserted() event handler for the SalesParmLine table. My issue is that this is never triggered. I have tried both of these methods. Does anyone know why these wouldn't be fired? Any alternative recommendations? I can't use the SalesEditLines form event handlers because we will be using batch invoicing.
#1)
[PostHandlerFor(tableStr(SalesParmLine), tableMethodStr(SalesParmLine, insert))]
public static void SalesParmLine_Post_insert(XppPrePostArgs args)
{
SalesParmLine salesParmLineLoc;
Common tablefromevent;
CustPackingSlipJour custPackingSlipJourLoc;
SalesParmTable salesParmTableLoc;
SalesParmSubTable salesParmSubTableLoc;
SalesTable salesTableLoc;
;
//salesTableLoc = args.getThis();
tablefromevent = args.getThis();
if(tablefromevent.TableId==tableNum(SalesParmLine))
{
salesParmLineLoc = tablefromevent;
salesParmTableLoc = salesParmLineLoc.salesParmTable();
salesTableLoc = salesParmTableLoc.salesTable();
if(salesParmTableLoc.ParmJobStatus == ParmJobStatus::Waiting)
{
select firstonly salesParmSubTableLoc where salesParmSubTableLoc.ParmId == salesParmTableLoc.ParmId && salesParmSubTableLoc.TableRefId == salesParmTableLoc.TableRefId && salesParmSubTableLoc.journalRefTableId==tableNum(CustPackingSlipJour);
select firstonly custPackingSlipJourLoc where custPackingSlipJourLoc.RecId==salesParmSubTableLoc.JournalRefRecId;
//call caclulation //trigger tax code.
//run custom code here.
}
}
}
#2)
[DataEventHandler(tableStr(SalesParmLine), DataEventType::Inserted)]
public static void SalesParmLine_onInserted(Common sender, DataEventArgs e)
{
SalesParmLine salesParmLineLoc;
Common tablefromevent;
CustPackingSlipJour custPackingSlipJourLoc;
SalesParmTable salesParmTableLoc;
SalesParmSubTable salesParmSubTableLoc;
SalesTable salesTableLoc;
;
tablefromevent = sender;
if(tablefromevent.TableId==tableNum(SalesParmLine))
{
salesParmLineLoc = tablefromevent;
salesParmTableLoc = salesParmLineLoc.salesParmTable();
salesTableLoc = salesParmTableLoc.salesTable();
if(salesParmTableLoc.ParmJobStatus == ParmJobStatus::Waiting)
{
select firstonly salesParmSubTableLoc where salesParmSubTableLoc.ParmId == salesParmTableLoc.ParmId && salesParmSubTableLoc.TableRefId == salesParmTableLoc.TableRefId && salesParmSubTableLoc.journalRefTableId==tableNum(CustPackingSlipJour);
select firstonly custPackingSlipJourLoc where custPackingSlipJourLoc.RecId==salesParmSubTableLoc.JournalRefRecId;
//call caclulation //trigger tax code.
//run custom code here.
}
}
}
Thanks,
Don Shields
*This post is locked for comments