EngWorkBench -- get view costs records from another comany via SetCompanyID

Hey,

This is for a situation where you manufacture in company 1 and sell in company 2. I have an updatable BAQ that’s getting the cost view result from EngWorkBench.ViewCosts in a pre-process BPM on GetList and writes the output to UD109 for the BAQ display, and then deletes the UD109 record in the post process.

It works fine in the company I’m logged into, but it’s just not getting any output when I change companies temporarily in the BPM.

My user ID is good in both companies. The parts are set up the same – I’m working in an environment where the second company is basically a copy of the first company.

I can change plants okay, but not the company. All the data looks good when display from the BPM. I can run the query from the company 2 okay and have the same issue with getting no results from company 1.

See any obvious issues?

Thanks,

Joe

// get costs view

Erp.Contracts.EngWorkBenchSvcContract ewb = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.EngWorkBenchSvcContract>(this.Db, true);

dsEWBCosts = new Erp.Tablesets.EngWorkBenchCostsTableset();

using (CallContext.Current.TemporarySessionCreator.SetCompanyID(company).Create()) {

  using (CallContext.Current.TemporarySessionCreator.SetPlantID(plant).Create()) {
  
    dsEWBCosts = ewb.ViewCosts(groupID,partNum,revisionNum,altMethod,asOfDate,quantity,maxLevel,assembliesOnly);
    
    this.PublishInfoMessage(company+ " " + plant+ " " + groupID+ " " + partNum+ " " + revisionNum+ " " + altMethod+ " " + asOfDate+ " " + quantity+ " " + maxLevel+ " " + assembliesOnly, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
  }
}