Search code examples
acumatica

Unable to enable a custom field in Cases


I am trying to enable the custom field in Case when the Status is in Closed State. I am working on a customization for Acumatica version 20.114.0020 (2020 R1).

I have created a custom field usrIsNotBillable in CRCase DAC.

[PXDBBool]
[PXUIField(DisplayName="Confirmed Not Billable", Enabled = true)]
public virtual bool? UsrIsNotBillable { get; set; }
public abstract class usrIsNotBillable : PX.Data.BQL.BqlBool.Field<usrIsNotBillable> { }

It is totally working fine when the Case is in other states than Closed. But when the case is closed, every other property gets disabled. But I want this field to be set enabled. So, I override the Row Selected method for CRCaseMaint graph as below:

protected void CRCase_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
    {
            InvokeBaseHandler?.Invoke(cache, e);
            CRCase row = (CRCase) e.Row;
            if (row == null) return;
            Base.CaseCurrent.Cache.AllowUpdate = true;
            Base.CaseCurrent.AllowUpdate = true;
            PXUIFieldAttribute.SetEnabled<CRCaseExt.usrIsNotBillable>(cache, row, true);
    }

If I use other DAC fields such as IsBillable like this:

PXUIFieldAttribute.SetEnabled<CRCase.isBillable>(cache, row, true);

It just works fine.

I checked other examples too and the implementation is similar to this. I am just not sure why it is not working in this case.

I have also checked if this screen has any existing workflows and it doesn't.

Any help would be appreciated.

Thanks.


Solution

  • Besides writing code to enable the field in RowSelected event, it is also important to add the field in Closed state in the Workflow.

    However, if this is also not working deleting contents of CstDesigner of project does the job.