how to get branch office by name or ID and not by GUID.
I am trying to assign a branch office to an existing job site.
while creating a new job site i would like to assign a branch office ( Stockinglocationorganization).
in order to set that value , we need to know guid of the branch office. i know branch office number and name but i am looking for a method to find guid of that stockinglocationorganization by name or number of the branch .
I think I have found the solution for this . but I have additional question on the method GetJobSites().
The question is
With GetJobsites , The list is not limiting to the stocking //locationid and its printing all the jobs instead of filtering per stocking location id. need help please. appreciate response on this.
Here is the example I have tried to find get details of Office by name.
//Get Branch details by name
TradingPartner tradingPartner = TradingPartner.GetTradingPartner("YourBranchName");
//Branch details by stocking location id . GUID
StockingLocation sl = StockingLocation.GetOrganization(tradingPartner.StockingLocationID,true);
//Note :sunny: The problem I am having with GetJobsites , The list is not limiting to the stocking //locationid and its printing all the jobs instead of filtering per stocking location id. need help please.
StockingLocationList slist = StockingLocationList.GetJobsites(true, JobTreeNodeDisplayType.Number, tradingPartner.StockingLocationID);
foreach (StockingLocationListItem item in slist)
{
Console.WriteLine(item.Name);
}
Don’t forget to add using System.Linq; to your code.
Also, please note that if you have additional child nodes on that branch (sub-branches, laydown yards, etc.) you’ll want to add additional conditions in the Where() method to filter for the children Job Sites of those as well.