In 2023R1
I have a custom field UsrOriginalPromise to the Purchase Orders Details. I am enabling all three fields shown below for closed orders.
Requested Date is the Requested field with a modified label. Current Promise is Promised with a modified label. Those are built in fields that I am able to get enabled for editing.
I added all three fields to the Closed Workflow. I also added the following code to finish the job of enabling the cache and enabling the fields: THIS IS IN THE PROJECT EDITOR, NOT VS.
If I remove the comments from the lines below, the two built in fields get enabled, but the custom field does not, AND there are errors on the PO3010PL entry point screen and in the Project editor.
public class POOrderEntry_Extension : PXGraphExtension<PX.Objects.PO.POOrderEntry>
{
#region Event Handlers
protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if(InvokeBaseHandler != null) InvokeBaseHandler(cache, e);
var row = (POLine)e.Row;
//POLineExt itemExt = PXCache<POLine>.GetExtension<POLineExt>(row);
//if (itemExt == null) return;
Base.Transactions.Cache.AllowUpdate = true;
PXUIFieldAttribute.SetEnabled<POLine.requestedDate>(cache, row, true);
PXUIFieldAttribute.SetEnabled<POLine.promisedDate>(cache, row, true);
//PXUIFieldAttribute.SetEnabled<POLineExt.usrOriginalPromise>(cache, row, true);
}
#endregion
}
If I remove the // from JUST the the line that gets a reference to the extension, it will publish. But if you do that and try to open PO3010PL (entry point for PO’s), you get this error:
In the project Editor, if you click on the screen ID to edit the screen, you get this error:
To make sure my syntax was correct, I created a library in VS. I just added this code into the extension
protected void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if (InvokeBaseHandler != null) InvokeBaseHandler(cache, e);
var row = (POLine)e.Row;
POLineExt itemExt = PXCache<POLine>.GetExtension<POLineExt>(row);
if (itemExt == null) return;
Base.Transactions.Cache.AllowUpdate = true;
PXUIFieldAttribute.SetEnabled<POLineExt.usrOriginalPromise>(cache, row, true);
}
If I add this library to the site, the custom field gets enabled. However, you still get the error on the entry point screen and in the project editor.
If you go directly to the PO301000 screen and lookup a PO, it works and all three fields are editable.
In summary, if I use a VS library to enable the custom field, it works, but causes errors on the entry point screen and in the project editor.
I uploaded the project if anyone wants to see the entire project.
Very strange.