Attribute ID Selector Determines Field Values in Custom Field

  • 27 July 2021
  • 1 reply

Userlevel 1

I have created a line level field in AP303000 form and I need to have Attribute ID selector 

namespace MidayaCustomizations
public class APTranExt : PXCacheExtension<PX.Objects.AP.APTran>
#region UsrAttributeSelection
[PXUIField(DisplayName = "Attribute ID")]
[PXSelector(typeof(Search<CSAttributeDetail.attributeID,Where<CSAttributeDetail.attributeID, Equal<CSAttribute.attributeID>>>),
public virtual string UsrAttributeSelection { get; set; }
public abstract class usrAttributeSelection : PX.Data.BQL.BqlString.Field<usrAttributeSelection> { }

#region UsrAttributeValues
[PXUIField(DisplayName = "Attribute Values")]

public virtual string UsrAttributeValues { get; set; }
public abstract class usrAttributeValues : PX.Data.BQL.BqlString.Field<usrAttributeValues> { }

And I need to get the Attribute ID from that field and in the UsrAttributeValues field, the values from that particular attribute should be populated (eg- Attribute ID “CSS” is a dropdown field and in UsrAttributeValues field these list of values should be available to be selected). 

protected void APTran_UsrAttributeSelection_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
InvokeBaseHandler?.Invoke(cache, e);
APTran row = (APTran)e.Row;
if (row == null) return;
var rowExt = PXCache<APTran>.GetExtension<APTranExt>(row);

List<string> allowedValues = new List<string>();
List<string> allowedLabels = new List<string>();

if (rowExt != null)
foreach (CSAttributeDetail objCSAttributeDetail in PXSelect<CSAttributeDetail,
Where<CSAttributeDetail.attributeID, Equal<Required<APTranExt.usrAttributeSelection>>>>.Select(Base, rowExt.UsrAttributeSelection))

e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 10, true, typeof(APTranExt.usrAttributeValues).Name, false, -1, string.Empty, allowedValues.ToArray(), allowedLabels.ToArray(), false, null);


Currently trying to use a field updated event, but I am facing errors, any help would be appreciated.


Best answer by Naveen B 27 July 2021, 08:22

View original

1 reply

Userlevel 7
Badge +9

Hi @TharidhiP  “UsrAttributeSelection” selector will display the duplicate AttributeIDs from CSAttributeDetail table. If you want to load all the attribute id’s use the CSAttribute table instead of CSAttributeDetail.


For the dropdown control, we need to use the Fieldselecting event to load the attribute values. please use the below syntax

Ex: APTran_UsrAttributeSelection_FieldSelecting


Let me know if you have any doubts on this.


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved