General X++ Development
How do I make a SysOperation batch job run in a specific company?
How do I make a SysOperation batch job run in a specific company?
1 answer
Write an answerIf the process needs to operate in a company different from the current execution context, pass the company on the contract and switch explicitly.
changeCompany(_contract.parmDataAreaId())
{
// Company-specific processing.
}Do not assume the batch task will always execute in whichever company you happened to have open when you scheduled it.
Also remember that standard batch tasks themselves have a company context, so only use changeCompany when the process genuinely needs to cross into a different legal entity.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer