Hi everybody,
I am facing a problem I am sure is not so hard, but I cannot find my way through it.
So, my objective is to extend the Purchase Order Header with the Project Task ID.
I created the extension field first, as below:
But I just cannot find how to populate it automatically from the data in the Project Task field.
I tried a Relation in a BO extension going through the AccountingBlockAssignement, but it seems to not be functional.
I also tried to make a Reference to the extension field and created an Event After Modify like:
this.projecttaskpo = this.ExtensionForPO.content
The Project Task PO is my reference to the extension field created in the Cloud Solution.
And the ExtensionForPO is my relation to the TaskID:
import AP.Common.GDT;
import AP.Purchasing.Global as Purchasing;
import AP.ProjectManagement.Global as ProjectManagement;
import AP.IS.CodingBlock.Global as Coding;
[Extension] businessobject AP.Purchasing.Global:PurchaseOrder {
[Relation(Coding:AccountingCodingBlockDistribution.AccountingCodingBlockAssignment.ProjectTaskKey.TaskID)]
[Label("Project ID")] element ExtensionForPO : TaskID;
node Item {
}
}
I am pretty sure this is not so hard, but I can't figure how to do it.
The Task ID is in the Line Item so I do not understand why it could be so hard to add it in the Purchase Order Header.
Moreover, when I try to make the path directly from the PurchaseOrder, like:
PurchaseOrder.Item.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.ProjectTaskKey.TaskID
It returns to me that the association between Item and ItemAccountingCodingBlockDistribution is not a node. I know that, but it would be perfect if I could directly go from the Purchase Order BO to the Project Reference and the Project Tasks. But I cannot do that.
Any help on this would be greatly appreciated as it is quite a recurring request from customers.
I could have a misunderstanding in the process of doing it, or even in the code as I am a pure development newbie, so I m open to all propositions.
Thank you all.
Have a nice day.
Jacques-Antoine