0
votes

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.

1
Check for an Automation Step or Workflow disabling the cache when the state is Closed. I've had a similar issue with PO Receipt Lines where Automation Steps were disabling the cache with my extension. These layer on top of your programmed code.Brian Stevens
I looked at the Automation Step and there isn't anything explicit that is disabling the fields or even the Cache. Then I checked the Workflow and doesn't look like it lets me override DEFAULT workflow. Weirdly, the State Identifier field was disabled, and just trying to add new workflow throw exceptions to me. Below are the links to the screenshots: imgur.com/INdSkRT imgur.com/Bm3iJKw imgur.com/uUXMpG6Bikash Lama
Looks like you don't have a workflow added in the project, so there isn't anything to edit. As far as I know, there is no need to add it for this issue, but you would Add a Workflow before you would make edits in that workflow screenshot. Maybe they will cleanup the UI in future releases, but for now it looks like your issue is not the one with which I am familiar.Brian Stevens
Yeah. So, if there is no existing workflow that might be overriding my customization, I wonder what could be the issue. Thanks for your insight.Bikash Lama
Just adding here that performing Apply Updates also didn't solve this.Bikash Lama

1 Answers

0
votes

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.