Skip to main content
Answer

SOShipmentEntry graph extension: how do I get the SiteCD using the SiteID from the first SOShipLine?

  • January 16, 2025
  • 2 replies
  • 76 views

Forum|alt.badge.img+2

I’m trying to get the Warehouse name from Details in the SOShipment.  I was able to get the integer ID using this:

SOShipLine firstLine = Base.Transactions.SelectSingle();

 

The firstLine.SiteID has the ID but how do I get the SiteCD (name)?

Best answer by Django

INSite site = INSite.PK.Find(Base, firstLine.SiteID);

 

.PK.Find gives you a way to find the INSite record using the SiteID

.UK.Find gives you a way to find the INSite record if you have the SiteCD

2 replies

Forum|alt.badge.img+7
  • Captain II
  • Answer
  • January 16, 2025

INSite site = INSite.PK.Find(Base, firstLine.SiteID);

 

.PK.Find gives you a way to find the INSite record using the SiteID

.UK.Find gives you a way to find the INSite record if you have the SiteCD


DipakNilkanth
Pro III
Forum|alt.badge.img+13

Hi ​@bpgraves,

To fetch the SiteCD, you can use below code snippet.
 

SOShipLine firstLine = Base.Transactions.SelectSingle();

if (firstLine != null && firstLine.SiteID != null)
{
INSite warehouse = PXSelect<INSite,
Where<INSite.siteID, Equal<Required<INSite.siteID>>>>
.Select(Base, firstLine.SiteID);

if (warehouse != null)
{
string siteCD = warehouse.SiteCD;

}
}

Hope, it helps!