I have extension of EcoResReleasedProductV2Entity.
I have written this code in postLoad eventhandler to insert records in custom table.
But now the issue is its inserted all the companies records of entity into the current running company in the custom table.
Ex: if i run the data management in USMF company , in entity if i am having inventTable related records in 5 company then it's inserting all the 5company information in USMF entity of my custom table. So in entity i am having records from different legal entity but in my custom table all records inserted in one legal entity.
I used crossCompany, changeCompany keywords but its not working
How to insert data in respective legal entity as of data entity data.
///
/// </summary>
/// <param name=/_sender/></param>
/// <param name=/_eventArgs/></param>
[DataEventHandler(tableStr(EcoResReleasedProductV2Entity), DataEventType::PostedLoad)]
public static void EcoResReleasedProductV2Entity_onPostedLoad(Common _sender, DataEventArgs _eventArgs)
{
EcoResReleasedProductV2Entity EcoResReleasedProductV2Entity = _sender;
EcoResReleasedProductV2Entity EcoResReleasedProductV2EntityLoc;
ITPriceHistory priceHistory;
// where EcoResReleasedProductV2EntityLoc.RecId == EcoResReleasedProductV2Entity.RecId;
{
priceHistory.Price = EcoResReleasedProductV2Entity.PurchasePrice;
priceHistory.ContractPrice = EcoResReleasedProductV2Entity.ContractPrice;
priceHistory.ItemId = EcoResReleasedProductV2Entity.ItemNumber;
// priceHistory.DataAreaId = EcoResReleasedProductV2Entity.DataAreaId;
priceHistory.insert();
ttscommit;
}
}