Skip to main content
Question

How to copy business rules/behavior from an Inventory Item Status code to a custom added code

  • December 13, 2025
  • 2 replies
  • 27 views

PaulMainard55
Captain II
Forum|alt.badge.img+2

Hi Community,

Our client requires that all newly created Inventory Items are reviewed for quality control and approved prior to activation.

My initial thought was to simply change the default status of new stock items to “Inactive” so that the item can be placed in a review queue GI/Dashboard.  As I was thinking about this, I realized the client may have a legitimate reason for marking an Inventory Item as “Inactive” for reasons other than the item having been newly created.  I thought that I could couple this with a “reviewed” attribute, but we don’t have a viable to lock down a single attribute prompt without locking them all down for a group of users.  

This led me to add a new drop down value to the Item Status field called “RE - Needs Review” which we would use to drive the review.  The problem with this is that there are no business rules to prevent the newly created from being used with this status.   

My question is, is it possible through no code/low code customization to allow a newly created Item Status code to inherit the business rules of an out-of-the-box status code; specifically, I want the “Needs Review” status to behave just like the “Inactive” status to prevent users from selecting the item for any transaction until activated.  

2 replies

Forum|alt.badge.img+8
  • Captain II
  • December 19, 2025

You can create a custom field for example,

[PXBool]

//No need for PXUIField

public virtual bool? UsrIsReviewer { get; set; }

public abstract class usrIsReviewer : BqlBool.Field<usrIsReviewer> { }

Then create a condition in that checks if this value is false in the customisation editor and add this as the condition for ‘Disabled’.

 

Then add a RowSelected handler to set this value once the screen is loaded.

protected virtual void _(Events.RowSelected<InventoryItem> e, PXRowSelected b)
{
InventoryItem row = e.Row;
if (row == null)
return;

YourDacExtensionName rowExt = row.GetExtension<YourDacExtensionName>();

if(rowExt.UsrIsReviewer == null)
return;

if(isSpecifiedUserRole("Inventory Reviewer", Base))
{
rowExt.UsrIsReviewer = true;
}
else
{
rowExt.UsrIsReviewer = false;
}
}

public static bool isSpecifiedUserRole(string roleName, PXGraph graph)
{
string usrName = graph.Accessinfo.UserName;

UsersInRoles assignedRoles = SelectFrom<UsersInRoles>.
Where<UsersInRoles.username.IsEqual<P.AsString>.
And<UsersInRoles.rolename.IsEqual<P.AsString>>>.View.Select(graph, usrName, roleName);
if (assignedRoles == null)
return false;

else return true;
}

 

Hope this helps!


PaulMainard55
Captain II
Forum|alt.badge.img+2
  • Author
  • Captain II
  • December 20, 2025

Hi ​@aiwan ,

Thanks for chiming in and for the suggestion.  We may potentially engage a developer for a solution like this.  Based on the code samples provided, this appears to be fairly light, is reasonably intuitive and potentially viable.  

The ask is whether or not there’s a simple, no code way to apply the business rules of an Inventory status code can be copied to a newly created status code to meet the client’s requirement.  

I suspect that a solution like the one provided may be a path we go down, or we simply give the client something that they have in their legacy system with some time fence parameters to identify those items requiring review.  

 

Thanks again!