How to modify PXIntList dynamically in Acumatica
Hello everybody,
today I want to leave a short code sample on how to modify PXIntList or dropdown list in Acumatica. Below goes code sample of it:
protected virtual void _(Events.RowSelected<CROpportunity> e) { if (e.Row == null) return; var opportunityExtension = e.Row.GetExtension<CROpportunityExt>(); if (opportunityExtension.UsrProduct == 0) { var listInts = new List<int>(); var listStrings = new List<String>(); listInts.Add(0); listInts.Add(1); listInts.Add(2); listStrings.Add("String 1"); listStrings.Add("String 2"); listStrings.Add("String 3"); PXIntListAttribute.SetList<CROpportunityExt.usrProposition>(e.Cache, e.Row, listInts.ToArray(), listStrings.ToArray()); } if (opportunityExtension.UsrProduct == 1) { var listInts = new List<int>(); var listStrings = new List<String>(); listInts.Add(0); listInts.Add(3); listInts.Add(5); listStrings.Add("String 2"); listStrings.Add("String 3"); listStrings.Add("String 4"); PXIntListAttribute.SetList<CROpportunityExt.usrProposition>(e.Cache, e.Row, listInts.ToArray(), listStrings.ToArray()); } }
This code sample has two most important parts:
- RowSelected ( declared over new syntax )
- PXIntListAttribute.SetList<CROpportunityExt.usrProposition> call
With usage of those two principles you can easily get modifiable collection accoding to necessary conditions in your code.
If you're looking to customize your Acumatica instance, we’re here to help! This code sample illustrates how simple modifications to PXIntList and dropdown lists can be, but your unique business needs might require more tailored solutions.
Don’t hesitate to reach out for a customization request—our team is ready to bring your Acumatica environment to the next level with precision and efficiency. Contact us today and let’s discuss how we can make Acumatica work even better for you!