Solved

GetItemExtension failed error on projects screen

  • 12 May 2023
  • 7 replies
  • 233 views

Userlevel 2
Badge

I am getting the “GetItemExtension failed.” error while changing the value of the Group by Task checkbox in revenue budget tab of Projects screen (PM301000).

 

I am trying to add RowSelected event to implement my logic to display my custom column.
 

protected void RevenueBudgetFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
RevenueBudgetFilter row = (RevenueBudgetFilter)e.Row;
if (row == null) return;

if (row.GroupByTask ?? false)
{
PXUIFieldAttribute.SetVisible<PMRevenueBudgetExt.usrField>(this.Base.RevenueBudget.Cache, null, false);
}
else
{
PXUIFieldAttribute.SetVisible<PMRevenueBudgetExt.usrField>(this.Base.RevenueBudget.Cache, null, true);
}
}

 

icon

Best answer by darylbowman 12 May 2023, 16:58

View original

7 replies

Userlevel 7
Badge +17

Hi @param2022  Can you please extend the DAC for this DAC in the RowSelected event and check once.

PMRevenueBudgetExt

Userlevel 2
Badge

@Naveen Boga This is the DAC it is a virtual field. 

public class PMRevenueBudgetExt : PXCacheExtension<PMRevenueBudget>
{
public static bool IsActive()
{
return true;
}

#region UsrField
[PXUIField(DisplayName = "New Field", Enabled = false)]
[PXString]
public virtual string UsrField { get; set; }
public abstract class usrField : BqlString.Field<usrField> { }
#endregion
}

 

Userlevel 7
Badge +17

@param2022  Can you please try below check?

     protected void RevenueBudgetFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
RevenueBudgetFilter row = (RevenueBudgetFilter)e.Row;
if (row == null) return;

foreach (PMRevenueBudget budget in Base.RevenueBudget.Select())
{
PMRevenueBudgetExt rowExt = budget.GetExtension<PMRevenueBudgetExt>();

if (row.GroupByTask ?? false)
{
PXUIFieldAttribute.SetVisible<PMRevenueBudgetExt.usrField>(Base.RevenueBudget.Cache, budget, false);
}
else
{
PXUIFieldAttribute.SetVisible<PMRevenueBudgetExt.usrField>(Base.RevenueBudget.Cache, budget, true);
}
}
}

 

Userlevel 2
Badge

@Naveen Boga I tried the code you provided there is no error. But as soon as I select the checkbox for Group by Task it unchecks itself. So that default Acumatica functionality is not working.

Userlevel 7
Badge +17

@param2022  Thanks for the confirmation that now you are not getting the issue related to GetItemExtension failed.

 

Can you please let me know what are you trying to achieve with the above code?

Userlevel 2
Badge

@Naveen Boga I want to hide my custom field from the grid when the “Group by Task” checkbox in revenue budget tab of Projects screen (PM301000) is checked. And when the checkbox is unchecked my custom field should be visible in the grid.

Badge +11

Just here to say that the eight lines of code you’re using to perform the show/hide can be condensed to one or two 🙂 Two is slightly easier to read.

 

bool groupByTask = row.GroupByTask ?? false;
PXUIFieldAttribute.SetVisible<PMRevenueBudgetExt.usrField>(this.Base.RevenueBudget.Cache, null, !groupByTask);

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved