Skip to main content

Hi expert.

In this screen, When I choice Customer in Price Type Dropdown then Price Code Field will be visible, opposite I choice All Pricees in Price Type Dropdown then Price Code Field will be invisible. 

Now I want change flow, Price Code Field always visible. I try code below, but not effect. I forecast my code conflict with base function this screen. Please show me some suggestion. Thank you so much.

 var row = (ARSalesPriceFilter)e.Row;
            InvokeBaseHandler?.Invoke(cache, e);
            if (row != null && row.PriceType != null && PriceTypesp"All Prices"].Equals(row.PriceType.Trim()))
            {
                PXUIFieldAttribute.SetVisible<ARSalesPriceFilter.priceCode>(cache, null, true);
            }

If you tried to make the field enabled/visible on RowSelectedEvent of the Filter DAC and didn’t work, then Acumatica might have a CacheAttached/implementation logic that overrides it. Add a CacheAttached Event on the desired field in your graph extension and set the Visibility/Enabled to true and should override everything. There are plenty of examples for CacheAttached handler if you search the Source you can copy one and modify.


I tested the below code and it works (see the below snip) for this purpose but when something out of the box is disabled or made invisible based on the other values there is a reason. The Price Code field is now always enabled and visible but you may face bigger issues and challenges. But pal as suggested in the previous post, you need to go through the T series course assuming you know C#. With all respect, you can not jump into the customization without a basic understanding of the Acumatica customization engine and its platform.

 

using PX.Data;
using PX.Objects.AR;

namespace HCL
{
public class HCLARSalesPriceMaint : PXGraphExtension<ARSalesPriceMaint>
{
public static bool IsActive() => true;

protected virtual void _(Events.RowSelected<ARSalesPriceFilter> e)
{
if (e.Row == null) return;

PXUIFieldAttribute.SetVisible<ARSalesPriceFilter.priceCode>(e.Cache, null, true);
PXUIFieldAttribute.SetEnabled<ARSalesPriceFilter.priceCode>(e.Cache, null, true);
}

PXMergeAttributes(Method = MergeMethod.Merge)]
PXUIField(DisplayName = "Price Code", Enabled = true, Visible = true, Visibility = PXUIVisibility.Visible)]
public virtual void _(Events.CacheAttached<ARSalesPriceFilter.priceCode> e) { }
}
}

 


@aaghaei Thank you so much. I’m newbie Acumatica. I try practice all T series course everyday parallel to the custom task. 

This is a limited custom system (does not allow deep intervention like other .Net, Java frameworks), it took me a long time to learn at first. You have helped me many times.I just hope you and your family stay healthy. Wishing your dear women a Happy International Women's Day.

Sure, good luck. We all are learning from each other and available resources.


Reply