Trying to set the customer based on the selection of a project. However I get a validation error.
public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{
protected void (Events.FieldUpdated<SOOrder, SOOrder.projectID> e)
{
if (e.Row == null) return;
SOOrder so = (SOOrder)e.Row;
if(so.CustomerID == null && so.ProjectID != null)
{
var prj = PMProject.PK.Find(e.Cache.Graph,so.ProjectID);
e.Cache.SetValue<SOOrder.customerID>(e.Row, prj.CustomerID ?? null);
}
}
}
results in when the project is selected.
I have tried both SetValueExt and SetValue, SetValueExt causes the ProjectId to be set to null or “X”, while SetValue works as intended with the exception of the validation error.
The validation error occurs in both cases.
Unselecting the project, and then reselecting the project causes the error to go away.
How can I request the project field be revalidated for validation? or can I just clear the error?
I could not find the source of this validation error in SOOrderEntry, any ideal on how to locate the source?
Thanks