Skip to main content

I have managed to add two custom fields to the Line details (Time and Material) of the pro forma screen.

We need them to be editable once the status is closed, but in doing so using code, all the fields are editable which is a bit dangerous as the invoice is already released. 

I then checked the workflow and it has no setting for disabling all the Pro Forma Line line (All Fields) in the Closed Status.  I thought, lets add it.  Still all are editable.

 

Really need to stop all the other fields from being editable so hoping for some help here.

 

My code:

  public class ProformaEntry_Extension : PXGraphExtension<PX.Objects.PM.ProformaEntry>
  {
    #region Event Handlers

    protected void PMProformaTransactLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
      
      var row = (PMProformaTransactLine)e.Row;
      
    if (row == null) return;
        cache.AllowUpdate = true;
       PXUIFieldAttribute.SetEnabled(cache, row, true);
       PXUIFieldAttribute.SetEnabled<PMProformaLineExt.usrMAnoteID>(cache, row, true);
        PXUIFieldAttribute.SetEnabled<PMProformaLineExt.usrMAflag>(cache, row, true);
      

Hi @lbarker ,

We can enable the fields using workflow. 

Please refer to the below link
2021 R1 Enable Locked Fields | Community (acumatica.com)


That did not work, hence why I did code for this screen.  


This blog post has slightly different code than you have (aside from running on a different graph). Naveen is setting Base.Document.Cache.AllowUpdate to true along with Base.Transactions.Cache. But he is not calling SetEnabled on the whole row, just the required fields.

He also mentioned needing to do changes in the workflow as well.

Hopefully that helps!

 

https://asiablog.acumatica.com/2021/10/enable-customization-fields-when-document-is-completed.html


Thanks so much but it also does not work, as if I don’t enable the row first, it leaves the custom fields disabled so something is different with this screen, so this was the only solution.   

Hoping someone worked out how to do this on this screen.


Hi @lbarker 

Have you tried:

if(row.Status != “C”)

{

PXUIFieldAttribute.SetEnabled(cache, row, true);

       PXUIFieldAttribute.SetEnabled<PMProformaLineExt.usrMAnoteID>(cache, row, true);

        PXUIFieldAttribute.SetEnabled<PMProformaLineExt.usrMAflag>(cache, row, true);

}

 

Also, if this is not a custom screen, you should override the event handler e.g., _(Events.RowSelected<PMProformaTransactLine> e, PXRowSelected b)

 

Hope this helps!

Aleks


Hi @lbarker 

 

You will also need to add the following line into your code to get the DAC extension.

PMProformaTransactLine rowExt = PXCache<PMProformaTransactLine>.GetExtension<PMProformaTransactLineExt>(row);

 

Aleks


Looks like the system marked it as answered but I have tried your suggestions and no luck. 

The entire line is still enabled.  Will keep investigating it with my dev team as as not wanting all the fields editable as too dangerous.

Thanks for your advise so far, appreciate it.


Reply