General X++ Development

How do I make a SysOperation batch job run in a specific company?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I make a SysOperation batch job run in a specific company?

SSunny Vasty75 reputation · answered Aug 13, 2026

If the process needs to operate in a company different from the current execution context, pass the company on the contract and switch explicitly.

X++
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.