What Orchestrate gives you for unique IDs

Orchestrate has a function that returns a unique ID and, as far as Workday's Developer Guide documents, no component or function that returns the next number in a counter. The function is randomUUID, in the random qualifier. It takes no arguments and returns a string holding a type 4 (pseudorandomly generated) UUID (Reference: Random Global Functions).

Call it like any other qualified function, for example in a Create Values step:

random.randomUUID()

The same page lists randomInteger, randomIntegerInRange and the list variants. The word "sequence" in their descriptions means the random number generator's output stream, not a counter. They return pseudorandom values, so two calls can return the same number. Do not use them to make an ID.

IDs Orchestrate already creates for every run

Each orchestration run carries its own identifiers, and you rarely need to invent a second one for tracing. context.orchestrateId() returns the orchestration instance ID, the value sent as X-Orchestrate-Id (Reference: Context Global Functions). On the app's Orchestration Activity dashboard, each run's Run ID column holds its unique instance ID, which Workday describes as the ID for correlating logs. Expanding the Run ID cell also shows the Common Request ID and a Process ID for each sequential process in the run (Concept: Orchestration Activity).

Store context.orchestrateId() next to any record or outbound message an orchestration creates. When someone later asks "which run made this?", you can filter the dashboard by Instance ID.

A run ID identifies the run, not the business record. One run can create several records, so it is a poor substitute for a record key.

When a UUID is the right key

Use a UUID when the ID only has to be unique and nobody has to read it: a correlation ID on an outbound HTTP request, an idempotency or external-reference key on a record you send to another system, a file name that must not collide.

Combine it with a readable prefix by concatenating strings with +, the same way Workday's own examples build values in Create Values (Concept: Optimizing Create Values Performance):

"EQR-" + random.randomUUID()

A UUID is not a number a person can say over the phone, it does not sort in creation order, and it has no padding. If the business wants "Request 000123", you need a real sequence.

Where real sequence generators live

A Workday sequence generator is tenant configuration, not an Orchestrate feature. You create it with the Create ID Definition / Sequence Generator task, or Create ID Definition / Gapless Sequence Generator when rolled-back transactions must not leave holes in the numbering. In the Sequence ID Format field you combine constants with variables, and a [seq] variable makes Workday number automatically. The Increment Sequence ID By and Padding fields control the step and the digit count, and Workday keeps a separate sequence for each ID definition that uses [seq] (Sequence Generator Variables). A format such as REQ-[year]-[seq] is valid: variables are case-sensitive, go in square brackets and cannot have more than four consecutive identical letters.

When the numbers feed an integration, check these three settings:

  • Gaps. A standard sequence generator can leave gaps if a transaction is rolled back. The gapless variant exists to prevent that (ID Definition and Sequence Generator Information).
  • Overflow. The Sequence Generator Padding Report shows how close each generator is to its maximum sequence number, plus its overflow behaviour and notification groups. Run it before a generator goes into a high-volume process.
  • Spaces in the format. If the number ends up in a URL, leave white space out of the format string; some sites do not encode spaces.

You attach an ID definition to a business object through the Edit Tenant Setup task for that area, and the Workday page lists objects such as invoices, orders, receipts, employees and beneficiaries as typical examples. If you do not select an ID definition, Workday generates its own internal ID codes. For purchase orders, requisitions, receipts and a few other procurement objects, the sequence generator ID you set up becomes the integration reference ID.

Sequences for integration files in Studio

Studio is the documented home of sequence numbers inside an integration. You add a sequence generator service on the workday-in transport and name a sequencer. After deployment, in the tenant you open Configure Integration Sequence Generators on the integration system and set Increment Sequence ID By and the Sequence ID Format. Workday's walkthrough uses a format of file[Seq].csv to produce sequenced file names on each run (Create Sequence Generator Services).

Inside the assembly, the launch parameters helper object's getSequencedValue(name) returns the current value of the named generator (Launch Parameters Helper Object). Numbered file names that must increase across runs are a reason to keep that integration in Studio; see Orchestrate versus Studio for the wider trade-off.

Numbering records in an Extend app

Workday documents no Extend or Orchestrate counter for business object records. That leaves two sound options, and which to use is a design decision, not something the documentation states.

If the number has to be gapless and human-readable, create the record in a Workday object that supports an ID definition and let Workday number it. If you must number your own Extend business object, do not read the highest number and add one inside an orchestration: two runs that start together can read the same value. Keep the record's own ID, or a UUID, as its real key and treat any display number as a separate field assigned by one serialised process.

Name that field carefully. id, wid, workdayID and displayID are reserved, case-sensitive field names that business objects cannot use, and field names must begin with a letter (Reserved Field Names on Business Objects). Something like requestNumber is free to use. For the wider question of when to add fields to Workday objects rather than to an Extend object, see custom business objects versus custom fields.

Proving the ID behaves

Run the orchestration twice from the same inputs and read both outputs back. Two different UUIDs confirm the function is evaluated per run, not captured once. Then open the Orchestration Activity table, expand the Run ID of each run, and check that the context.orchestrateId() value you stored on each record matches its run.

For a tenant sequence generator, create two test records, read both IDs back and confirm they increase by the Increment Sequence ID By value and carry the padding you set. After that, run the Sequence Generator Padding Report to see the percent usage.

Sources checked