Skip to main content
Answer

GetItemExtension failed error on projects screen

  • May 12, 2023
  • 7 replies
  • 371 views

param2022
Jr Varsity II
Forum|alt.badge.img

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);
}
}

 

Best answer by darylbowman

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);

 

7 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • May 12, 2023

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

PMRevenueBudgetExt


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • May 12, 2023

@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
}

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • May 12, 2023

@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);
}
}
}

 


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • May 12, 2023

@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.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • May 12, 2023

@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?


param2022
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • May 12, 2023

@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.


darylbowman
Captain II
Forum|alt.badge.img+15

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);