Example code to create a Jobsite assigned to a branch office

Hi, I need an example to create a Jobsite and assign or place it that belongs to a branch office

Here you go. First you grab the branch you want to add it to, then associated it through the ID’s

// Get the branch office
TradingPartner tp = TradingPartner.GetTradingPartner("YourBranchNameHere");
branch = StockingLocation.GetStockingLocation(tp.StockingLocationID, false);

// Create new job
StockingLocation job = StockingLocation.NewStockingLocation(PartnerTypes.JobSite, branch.StockingLocationID);
// Set parent ID
job.ParentTradingPartnerID = branch.TradingPartnerID;
job.Name = "UNIQUE NAME - TRAP EXCEPTION ON SAVE TO SEE IF IT'S UNIQUE";
// Add other properties here
// Check broken rules and save

Thank you very much, sorry the methods confuse me, if there was a documentation it was easier

1 Like

Not a problem at all. We try to answer all questions here as soon as possible.

i have a question related to creating a job. i see code in the example shows how to create a new job and assign properties.
Can you please refer me to find which method is used to save the job.

Please ignore my question . i found the method “Save()” on “StockingLocation”.