Hello,
We have an existed code customization that to set order line warehouse field to user’s default warehouse setting (which is a customization field)
The main codes are like below
Users currentUser = PXSelect<Users,
Where<Users.username, Equal<Current<AccessInfo.userName>>>,
OrderBy<Asc<Users.username>>>.Select(Base);
UsersExt userExt = PXCache<Users>.GetExtension<UsersExt>(currentUser);
cache.SetValueExt<SOLine.siteID>(row, userExt.UsrDefaultW);
It is working fine, however we don’t like it to work when creating transfer orders by screen “SO509000”.
we’d like to leave the line warehouse to Acumatica’s original logic when processing transfer order creation on screen "SO509000"
So, how can I tell the line is adding by request from “SO509000”?
Best answer by Naveen B
Hi @ray20
You can add ScreenID condition before assigning the warehouse to SOLine siteID. Please find the sample code below.
// Base.Document.Current.LastModifiedByScreenID != "SO509000")
if(GraphName.ViewName.Current.LastModifiedByScreenID != “SO509000”)
{
// This Logic will NOT excute when the request coming from Create Transfer Orders screen //SO509000
Users currentUser = PXSelect<Users, Where<Users.username, Equal<Current<AccessInfo.userName>>>, OrderBy<Asc<Users.username>>>.Select(Base); UsersExt userExt = PXCache<Users>.GetExtension<UsersExt>(currentUser); cache.SetValueExt<SOLine.siteID>(row, userExt.UsrDefaultW);
}
OR
if(GraphName.ViewName.Current.CreatedByScreenID != “SO509000”)
{
// This Logic will NOT excute when the request coming from Create Transfer Orders screen //SO509000
Users currentUser = PXSelect<Users, Where<Users.username, Equal<Current<AccessInfo.userName>>>, OrderBy<Asc<Users.username>>>.Select(Base); UsersExt userExt = PXCache<Users>.GetExtension<UsersExt>(currentUser); cache.SetValueExt<SOLine.siteID>(row, userExt.UsrDefaultW);
}
Hope this helps!!