Skip to main content

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.

 

 

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 


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?


@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);
}

}

 

 

 


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.


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

Please find the screenshot for reference.

 


Hi @Naveen Boga

thank you for your response.

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


@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


Reply