Hi,
I want to execute a batch with different user than it schedule, basically I want to run all the batches using a service account rather individual users who scheduled the job. Also this job has to run in server
I have modified the runsImpersonated as below but this is not executing the job by specified account while I check in batch job history. Is there any way I can achieve the same
public boolean runsImpersonated()
{
RunAsPermission perm;
UserId runAsUser;
SysUserInfo userInfo;
;
runAsUser = 'xxx’;
perm = new RunAsPermission(runAsUser);
perm.assert();
runas(runAsUser,classnum(XXXX),'run');
return true;
}
*This post is locked for comments
I have the same question (0)