Question

Set Required when the field is visible

  • 21 November 2022
  • 4 replies
  • 33 views

Userlevel 1

Hi experts,

Currently, I have a field Default Salesperson on SalesOrder Screen with following properties:

This field has a logic show/hide based on field Order Type:

I want to set this field required when it’s shown. However, The logic show/hide these field are very complex and I don’t have source code.

Do we have any solution for this?

 

Thank you for your help.

 

 


4 replies

Userlevel 7
Badge +12

Hi @mrthanhkhoi  Below link will explain you to make the required field on conditional basis.

Please review and let me know if you have any queries.

 

https://stackoverflow.com/questions/56008962/i-need-to-conditionally-set-a-field-to-be-required 

Userlevel 1

Hi @Naveen Boga, thanks for your link but I can’t resolve the issue.

I tried to create an event handler:

protected void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{

var row = (SOOrder)e.Row;
if(row!=null)
{

var isVisible = true; // somehow get visible of SOOrder.salesPersonID
PXUIFieldAttribute.SetRequired<SOOrder.salesPersonID>(cache, row, isVisible);
}

}

but I get error: 

error CS1501: No overload for method 'SetRequired' takes 3 arguments

 

Do you have any idea?

Userlevel 7
Badge +12

@mrthanhkhoi  Please check with the below code.

rotected void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{

var row = (SOOrder)e.Row;
if(row!=null)
{

var isVisible = true; // somehow get visible of SOOrder.salesPersonID
PXUIFieldAttribute.SetRequired<SOOrder.salesPersonID>(cache, isVisible);
}

}

 

 

 

Userlevel 1

Hi @Naveen Boga,

Thank you for your suggestion.

By the way, Do you know how to get visibility of field SOOrder.salesPersonID?

I mean I want to get the visibility of field SOOrder.salesPersonID (it is shown on screen or not) then set required to yes/no corresponding.

Reply


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 — 2022  Acumatica, Inc. All rights reserved