Hi All,
When I create a new record in Purchline then in my custom table, also record got inserted. And it is working fine.
Suppose , I delete any line from PurchLine then i like to delete the same record from my custom table.
I have a parameter, based on the parameter the record got inserted in my custom table. In the similar way, I try to delete the record from my custom table
For this, I wrote below code in Delete method on PurchLine extension class
public void delete(boolean _showInfoDelReserv , boolean updateOrderLineOfDeliverySchedule)
{
PurchQtyTracking purchQtyTracking,purchQtyTrackingDelete;
RefRecId recId;
PurchParameters purchParameters;
purchParameteres = PurchParameters::find();
if (purchParameters.PurchLineQtyChecking == noyes::Yes)
{
select * from purchQtyTracking
where purchQtyTracking.RefRecId == this.RecId;
if (purchQtyTracking)
{
recId = purchQtyTracking.RefRecId;
}
next delete();
// if any record delete from purchline then the same record should delete from PurchQtyTracking also
if (recId != 0)
{
delete_from purchQtyTrackingDelete
where purchQtyTrackingDelete.RefRecId == recId;
}
}
}
the requirement is -
If the parameter set to YES -
if record exist in PurchQtyTracing table then it should DELETE the record from both tables - Purch Line & PurchQtyTracking
If record NOT exist in PurchQtyTracking table, then it should DELETE record forom PurchLine. only
But when I tried to delete record form PurchLine then I got message "PurchLine.delete method called incorrectly"
If parameter is set to NO
then it shuold called standard delete operation only
Note - I not tried for delete action because the above delete operation execute based on parameter.
In delete action we can't set parameter. And it will work globally. So, I go for code in PurchLine - delete method
Pls give me more shed on this.
thansk!