Skip to main content
Answer

Selector modification

  • August 8, 2022
  • 7 replies
  • 129 views

Forum|alt.badge.img

It is about ContractItems Screen there is a field called SetupItem am trying to display in that selector all the items including KitItems 

i tried removing attributes and added new query but its not working out

Can u please help me with the solutions

  #region BaseItemID  
        [PXRemoveBaseAttribute(typeof(ContractInventoryItemAttribute))]
        [PXMergeAttributes(Method = MergeMethod.Append)]
         [Inventory]
        [PXRestrictor(typeof(Where<InventoryItem.kitItem, NotEqual<boolTrue>>), null)]
        //  [ContractInventoryItemAttributeNew]

        [PXUIField(DisplayName = "Setup Item")]
        public int? BaseItemID { get; set; }
        #endregion

Best answer by Naveen Boga

@FarhanaM60  If that is the case you need to remove the Restrictor as well like below.


Please find the code for reference.

 

 public class ContractItemMaintExt : PXGraphExtension<ContractItemMaint>
{

[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXRemoveBaseAttribute(typeof(ContractInventoryItemAttribute))]
[PXRemoveBaseAttribute(typeof(PXRestrictorAttribute))]
[Inventory(DisplayName = "Setup Item")]

protected virtual void ContractItem_BaseItemID_CacheAttached(PXCache cache) {}

}

 

7 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • August 8, 2022

Hi @FarhanaM60  Please use the below CacheAttached code to get the Stock Items in the Setup Item selector field.

Please find the code and screenshot for reference.

  public class ContractItemMaintExt : PXGraphExtension<ContractItemMaint>
{

[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXRemoveBaseAttribute(typeof(ContractInventoryItemAttribute))]
[PXRestrictor(typeof(Where<InventoryItem.kitItem, NotEqual<boolTrue>>), null)]
[Inventory]
protected virtual void ContractItem_BaseItemID_CacheAttached(PXCache cache) {}

}

 


Forum|alt.badge.img
  • Author
  • Freshman I
  • August 8, 2022

hi Thank you for the reply… but i want to display all inventory items which are in Kit specifications screen

 

Like In Inventory table Kit item must be true

 

When we restrict not equal true means it displaying all the items except kititem

when we say equal true its not displaying -its loading with the empty selector

 

 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • August 8, 2022

Hi @FarhanaM60  Can you please confirm that you wanted to display ONLY KIT ITEMS in the selector?

 


Forum|alt.badge.img
  • Author
  • Freshman I
  • August 8, 2022

no all items including kit items


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • August 8, 2022

@FarhanaM60  If that is the case you need to remove the Restrictor as well like below.


Please find the code for reference.

 

 public class ContractItemMaintExt : PXGraphExtension<ContractItemMaint>
{

[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXRemoveBaseAttribute(typeof(ContractInventoryItemAttribute))]
[PXRemoveBaseAttribute(typeof(PXRestrictorAttribute))]
[Inventory(DisplayName = "Setup Item")]

protected virtual void ContractItem_BaseItemID_CacheAttached(PXCache cache) {}

}

 


Forum|alt.badge.img
  • Author
  • Freshman I
  • August 8, 2022

Still its not working.. it is not bringing kit items into that selector


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • August 8, 2022

@FarhanaM60  The above code is working for me and it is showing Kits and all other Stock items.

Please replace the code with the new code and build properly and verify.