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.

  • 1
    I'm very aware that this should be an easy thing to answer. My goal is to have something that shows up in Google to save everyone the minute or two to find the actual answer. Commented Mar 11, 2020 at 22:15
  • Every identifier in Apex shares the same length restriction.
    – Adrian Larson
    Commented Mar 11, 2020 at 22:26
  • 1
    Oh wait, you're not asking about the length of the class name. Derp.
    – Adrian Larson
    Commented Mar 11, 2020 at 22:28

2 Answers 2


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


and looking at the output:

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

  • That would have been my second guess... Or, alternatively, I just wanted to play with really big numbers to see what I could come up with :p
    – sfdcfox
    Commented Mar 11, 2020 at 23:33

The maximum length is 255.

System.UnexpectedException: Job Name: data value too large: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... (max length=255)

As an aside, after 4000 characters, you get a different error:

System.AsyncException: failed to get existing job id

  • Who would have thought of 🤔💭 finding it out like this? @sfdcfox I like your approach :-p
    – Mitesh
    Commented Mar 12, 2020 at 2:55
  • Interesting that pushing past 4000 characters changes the nature of the error. Commented Mar 12, 2020 at 23:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .