public void ExecuteJobs(int?branchID, string companyName, object parentLongOperationKey) { this.MainContext.SaveCurrentContextValues(companyName, parentLongOperationKey); //Changing context branch id before launching long run operations PXContext.SetBranchID(branchID); try { this.ExecuteJobs_MaximizeJobsInParallel(); } catch (ThreadAbortException) { foreach (Guid childLongOperation in this.MainContext.childLongOperations) { var r = PXLongOperation.GetTaskList().FirstOrDefault(_ => _.Key == childLongOperation.ToString()); if (r != null) { PXLongOperation.AsyncAbort(r.NativeKey); } } } finally { //Restoring default branch id PXContext.SetBranchID(this.MainContext.BranchID); } }