Skip to main content

Hello!

I have made a custom field/custom attribute which is editable and required on page purchase requisition (Entity: PurchaseRequisition). I want the same field on the purchase order page (Entity: PurchaseOrder), but as an uneditable reference to the connected purchase requisition.

Both entities are able to host custom fields, and I understand that I must make some sort of read-only custom field on purchase order page as well, but I am lost with regards to what reference option/statement I should use.

Can anyone help?

If the base entity is on Requisitions, do you want the read only version to be on Purchase Order Lines? Those are the only elements of the purchase order that have a link to the Requisition if one exists, the Purchase Order Header (PurchaseOrder) does not have such a referenced link as far as I know. (that’s because multiple Requisitions can be consolidated into one Order).

 

I mean yeah a Requisition_No Exists on PurchaseOrder, but the Base View hardcodes it as Null, it was probably kept for legacy code reasons but is no longer in use.

 

You could still do a sort of ListAgg field to list any distinct value of your custom field in any requisition your purchase order lines are linked to, to display it in the Purchase Order Header

 

Something like this, for the Read Only Custom Field Code:

 

Argument: order_no

SQL statement:

select listagg(distinct cf$_<yourcustomfield>, ', ' on overflow truncate) within group (order by p.requisition_no)
from purchase_requisition_cfv p
where p.requisition_no IN (select requisition_no from purchase_order_line o where o.order_no = :order_no)

 

This will retrieve comma separated distinct values of your custom field in any requisition any of the purchase order lines are connected to, from your purchase order header.