Greeting everyone
I've created extension on from table PriceDiscAdmTrans
and add tow 3 fields also 2 method
1-SnapshotPrice
2-SnapshotCost
3-SnapshotNewCost
and i want to update some fields (SnapshotPrice,SnapshotCost) because value come from extension method but i still getting error message
and here my extension code
[ExtensionOf(tableStr(PriceDiscAdmTrans))]
final class PriceDiscAdmTrans_Extension
{
public display real PreviousPrice()
{
PriceDiscAdmTrans priceDiscAdmTrans;
PriceDiscAdmTable priceDiscAdmTable;
select firstfast priceDiscAdmTrans order by RecId desc
where priceDiscAdmTrans.ItemRelation==this.ItemRelation && priceDiscAdmTrans.relation==PriceType::PriceSales
&& priceDiscAdmTrans.AccountCode==this.AccountCode && priceDiscAdmTrans.AccountRelation==this.AccountRelation
&& priceDiscAdmTrans.ItemCode==this.ItemCode && priceDiscAdmTrans.InventDimId==this.InventDimId
&& priceDiscAdmTrans.FromDate==this.FromDate && priceDiscAdmTrans.ToDate==this.ToDate
join priceDiscAdmTable where priceDiscAdmTable.JournalNum == priceDiscAdmTrans.JournalNum && priceDiscAdmTable.Posted==true;
if(!this.SnapshotPrice || this.SnapshotPrice==0)
{
this.SnapshotPrice=priceDiscAdmTrans.Amount;
this.doUpdate();
}
return priceDiscAdmTrans.Amount;
}
public display real PreviousCost()
{
InventTableModule inventTableModule;
select * from inventTableModule where inventTableModule.ItemId==this.ItemRelation && inventTableModule.ModuleType==ModuleInventPurchSales::Invent;
if(!this.SnapshotCost || this.SnapshotCost==0)
{
this.SnapshotCost=inventTableModule.Price;
this.doUpdate();
}
return inventTableModule.Price;
}
}
and i getting on of those error sometimes when i open form
1-Cannot edit a record in Trade agreement journal lines (PriceDiscAdmTrans). The record shown has been updated by another user
2-Cannot edit a record in Trade agreement journal lines (PriceDiscAdmTrans). The record has never been selected.