Skip to main content
Solved

Make custom fields editable on Journal Transaction details

  • November 5, 2023
  • 3 replies
  • 242 views
  • Translate All

Joe Schmucker
Captain II
Forum|alt.badge.img+3

@Naveen Boga solved this problem for me before on the SO Lines grid

However, that was to enable native fields.  I’m using the same logic to try to enable two custom fields on the GL entry details, but I am unable to make them editable.

I’ve added what I think is the necessary code and changes to the workflow.  

 

namespace PX.Objects.GL
{
public class JournalEntry_Extension : PXGraphExtension<PX.Objects.GL.JournalEntry>
{
#region Event Handlers

protected void GLTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (GLTran)e.Row;

if (row != null)
{
//Allowing caches to update with below code
Base.BatchModule.Cache.AllowUpdate = true;
Base.GLTranModuleBatNbr.Cache.AllowUpdate = true;

GLTranExt glExt = PXCache<GLTran>.GetExtension<GLTranExt>(row);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrLoan>(cache, row, true);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrALE>(cache, row, true);
}
}



#endregion
}
}

Data is being saved to the DB, so there is nothing wrong with the fields:

I’ve no idea why this isn’t working.  It is almost a copy/paste from the solution from Naveen for SO Lines.

I’ve attached a copy of the project if anyone wants a closer look.

Best answer by Naveen Boga

@Joe Schmucker  Hope you are doing well.

Yes, Acumatica made few changes at GL transactions level. Can you please try with below code and confirm?

namespace PX.Objects.GL
{
public class JournalEntry_Extension : PXGraphExtension<PX.Objects.GL.JournalEntry>
{
#region Event Handlers

protected void GLTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (GLTran)e.Row;

if (row != null)
{
//Allowing caches to update with below code
Base.BatchModule.Cache.AllowUpdate = true;
Base.GLTranModuleBatNbr.Cache.AllowUpdate = true;

GLTranExt glExt = PXCache<GLTran>.GetExtension<GLTranExt>(row);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrLoan>(cache, row, true);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrALE>(cache, row, true);

PXUIFieldAttribute.SetReadOnly<GLTranExt.usrLoan>(cache, null, false);

PXUIFieldAttribute.SetReadOnly<GLTranExt.usrALE>(cache, null, false);

}
}



#endregion
}
}

 

View original

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Answer
  • November 6, 2023

@Joe Schmucker  Hope you are doing well.

Yes, Acumatica made few changes at GL transactions level. Can you please try with below code and confirm?

namespace PX.Objects.GL
{
public class JournalEntry_Extension : PXGraphExtension<PX.Objects.GL.JournalEntry>
{
#region Event Handlers

protected void GLTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (GLTran)e.Row;

if (row != null)
{
//Allowing caches to update with below code
Base.BatchModule.Cache.AllowUpdate = true;
Base.GLTranModuleBatNbr.Cache.AllowUpdate = true;

GLTranExt glExt = PXCache<GLTran>.GetExtension<GLTranExt>(row);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrLoan>(cache, row, true);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrALE>(cache, row, true);

PXUIFieldAttribute.SetReadOnly<GLTranExt.usrLoan>(cache, null, false);

PXUIFieldAttribute.SetReadOnly<GLTranExt.usrALE>(cache, null, false);

}
}



#endregion
}
}

 

Translate

Joe Schmucker
Captain II
Forum|alt.badge.img+3

Removed this comment.  Not needed!

 

Translate

Joe Schmucker
Captain II
Forum|alt.badge.img+3

PLEASE DISREGARD THAT LAST POST.  I was working with the WRONG workflow item!

Thanks again Naveen.

Translate