Change Company in Customization

Is it possible to change the company for a Business Object in a client side/form customization? My specific use case is attempting to duplicate a part from one company to another.

Can you use global parts?

It is possible to change the company, but it’s complicated. Global parts would be easier, and when set up correctly you can control the part updates from the parent company.

Change the session in customization, be careful to roll back, and set the original company after your steps.


The issue you will have with switching companies is you will have to provide the user who is doing the part entry access to both companies in order to switch.

I will be certain to test global parts further, but reading the help doc for it made them sound to not fit exactly for our needs. I was just informed we were doing this manually, so I figured I’d set up a customization for the process.

This will stay as a heavily restricted screen (maybe two end users will have access), so company access should be assured. I’ll set up a check for that.

Changing the company using oTrans.CoreSession.CompanyID worked well. As an added point of caution, all sorts of weird things start happening if this doesn’t get set back to the original company, so be sure to touch all your bases.

Hi guys, i’m testing this solution on E11.2.100 but it doesnt seem to work anymore, if I debug the UI, the oTrans.CoreSession and oTrans.Session do change the company but the code is still searching on the current company, basically I use these lines:

this.oTrans.CoreSession.CompanyID = company;
this.oTrans.SubmitToAgent(“SystemTaskAgent”, 0, 0);

I use those lines to print a report for two companies at the same time. it works on 10.2.500 but on E11 it print twice on the current company… have you found a solution for this on E11? O:

I was able to do a workaround using a BPM:

string company = "CompanyName";
using (CallContext.Current.TemporarySessionCreator.SetCompanyID(company).Create()) 
        callContextBpmData.Checkbox01 = true;
        using (var APAgedPayableReportSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.APAgedPayableReportSvcContract>(Db))
          APAgedPayableReportSvc.SubmitToAgent(ds, "SystemTaskAgent", 0, 0, "Erp.UIRpt.APAgedRecReport");
        callContextBpmData.Checkbox01 = false;

I added the callContextBpmData.CheckBox01 validation so it doesnt run again when submitting for the other company.