Solved

Set Required when the field is visible

  • 21 November 2022
  • 7 replies
  • 300 views

Userlevel 3
Badge

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.

 

 

icon

Best answer by Naveen Boga 3 December 2022, 17:11

View original

7 replies

Userlevel 7
Badge +17

@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 7
Badge +17

Hi @mrthanhkhoi  The Sales Person ID field will be available in the “Commissions” tab.

Please find the screenshot for reference.

 

Userlevel 7
Badge +17

@mrthanhkhoi  It will affect the event handlers code for sure if this is part of .DLL.

And, make sure that this field should be property as CommitChanges =true

Userlevel 7
Badge +17

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 3
Badge

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 3
Badge

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.

Userlevel 3
Badge

Hi @Naveen Boga

thank you for your response.

Do you have any idea why implementing event handler in .dll file does not affected?

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