[SalesForce] the maximum length for a scheduled job name

The question itself is relatively simple.

If I call System.schedule(String jobName, String cronExpression, Object schedulableClass), what is the maximum length for a scheduled jobname parameter?

The answer wasn't immediately apparent in the System class docs.

As an aside, I'm asking because I've run into a scenario where I need to go to extra lengths to ensure the scheduled job name is unique.

The current code I have takes into account the time when the job was scheduled. However, I've run into a scenario where a subscriber org has spun up all 50 Queueable jobs in one transaction. When each job runs it is trying to schedule another class to run. Depending on the exact timing, some of those resulting jobs end up with the same name. Exceptions are thrown. Jira tickets are raised.

Short of having the Request ID available in Apex to ensure uniqueness I'll need to burn some more characters in the job name. I just need to know how many characters I have to work with.

Best Answer

@sfdcfox beat me to it. However, I got the detail of 255 via:

System.debug(Schema.SObjectType.CronJobDetail.fields.Name);

and looking at the output:

Schema.DescribeFieldResult[...;getLabel=Job Name;getLength=255;...]