Hi.
I am having a bit of an issue with extension framework adding a few new fields in the Purchase order report.
I have created an extension of the PurchPurchaseOrderHeader table and added a few new fields:
Then I created an event handler class with this method:
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(tableStr(PurchPurchaseOrderHeader), tableMethodStr(PurchPurchaseOrderHeader, initFromPurchTableAllVersions))]
public static void PurchPurchaseOrderHeader_Post_initFromPurchTableAllVersions(XppPrePostArgs args)
{
PurchPurchaseOrderHeader purchPurchaseOrderHeader = args.getThis() as PurchPurchaseOrderHeader;
PurchTableAllVersions purchTableAllVersions = Args.getArg(identifierStr(_purchTableAllVersions)) as PurchTableAllVersions;
HcmWorkerEntity hcmWorkerEntity;
select firstonly hcmWorkerEntity where hcmWorkerEntity.RecId == purchTableAllVersions.WorkerPurchPlacer;
purchPurchaseOrderHeader.PaymTermId = purchTableAllVersions.Payment;
purchPurchaseOrderHeader.PurchPlacer = hcmWorkerEntity.Name;
purchPurchaseOrderHeader.PurchWorkerPhone = hcmWorkerEntity.PrimaryContactPhone;
purchPurchaseOrderHeader.PurchWorkerEmail = hcmWorkerEntity.PrimaryContactEmail;
}
Debugging through it seems that my purchPurchaseOrderHeader object is not the extended but the original and I get this in my watch list:
purchPurchaseOrderHeader.PurchWorkerPhone error CS1061: 'PurchPurchaseOrderHeader' does not contain a definition for 'PurchWorkerPhone' and no extension method 'PurchWorkerPhone' accepting a first argument of type 'PurchPurchaseOrderHeader' could be found (are you missing a using directive or an assembly reference?)
I was of the impression that creating an extension of the table would use that as the object in runtime not the original. What am I doing wrong?
*This post is locked for comments