Hello,
I have a user defined field Workorder, that I need to access from some business logic. How do I do this?
Thanks
Best answer by Vignesh Ponnusamy
View originalHello,
I have a user defined field Workorder, that I need to access from some business logic. How do I do this?
Thanks
Best answer by Vignesh Ponnusamy
View originalHi
User Defined fields are based on attributes and stored in a sibling table. For example for
FSAppointment you have the table FSAppointmentKvExt
You can create a DAC for that table and query it. Fields have a prefix ‘Attribute’ tied and it is link to the parent entity by NoteID - RecordID. Also you can see the definition in the table CSScreenAttribute
Remember that all user defined fields are linked to attributes. The way you define them is the way the data will be stored.
Hope this help
Hello
protected void SOOrder_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting baseevent)
{
if (baseevent != null)
baseevent(cache, e);
SOOrder row = (SOOrder)Base.Document.Current;
//var Itemcache = Base.Document.Cache;
var udfAMBATLEN = (PXStringState)cache.GetValueExt(row, "AttributeAMBATLEN");
if (Base.Document.Current.OrderQty > 5)
{
cache.SetValueExt(row, "AttributeAMBATLEN", "Greater than 5"); //To set the value of attri
}
else
{
cache.SetValueExt(row, "AttributeAMBATLEN", "Less than 5");
}
}
Note: If you have the AttributeID ProjectCategories, you should prefix it with the Attribute(like AttributeProjectCategories) in the GetValueExt.
Thanks, Vignesh
In case you are trying to READ the values in a UDF, this is the code I used. My UDF is a multi-select DDL so I split the values. If the value in one of your multi-select items has a comma, that will cause an issue. I don’t have that in my case.
PXFieldState udfValue = (PXFieldState)cache.GetValueExt(order, "AttributeHOLDID");
if (udfValue == null || udfValue.Value == null) return;
string[] values = udfValue.Value.ToString().Split(',');
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.