Skip to content
KiweelyKiweelyKiweely

Preventing Duplicate Initiate_Change_Job Business Process Events When a Workday Custom Agent Calls a Write Tool

When a Custom Agent write tool calls Initiate_Change_Job without returning a clear Change Job business process WID in its response payload, the LLM assumes the call did not produce a WID and retries. Return the explicit event WID, set Destructive annotations, and check for in-progress events.

  • Checked against Workday on
  • Applies to Workday Orchestrate
  • 4 min read
  • Published
  • By Kiweely
On this page

Why initiate_change_job fires multiple times in a single agent turn

When building a Workday Custom Agent that updates a worker’s assignment—such as calling initiate_change_job to extend a Contingent Worker’s contract end date and retrieve the resulting Change Job business process event WID (changeJobWid) for subsequent step updates—developers frequently observe the agent invoking initiate_change_job two or three times in a single conversation turn. In the tenant, each invocation spawns a separate in-progress Change Job business process event on the worker, or fails on the second call because an overlapping staffing event is already in progress.

This duplicate firing happens because the large language model (LLM) driving the Custom Agent relies entirely on the structured tool output and the .agentskill instructions to decide whether a step succeeded:

  1. Missing or unmapped changeJobWid on the Custom Agent Action End step: In a two-step staffing pattern (where initiate_change_job starts the template-based Change Job event and returns the event WID so a follow-up step can populate contract end date details), if the Custom Agent Action orchestration’s End step (Configure Response) returns an empty body, an unparsed XML envelope, or a generic message without the extracted changeJobWid, the model sees a null WID, concludes the initiation didn’t produce the required identifier, and immediately calls initiate_change_job again.
  2. Silent SOAP Fault or HTTP 200 validation error inside the orchestration: Send Workday API Request marks isSuccess = true whenever Workday returns an HTTP response, including when a SOAP call returns a SOAP-ENV:Fault or when a sub-step fails after Initiate_Change_Job has already committed. If the orchestration catches or mishandles a downstream error after initiating the event, the LLM retries the entire tool call from the beginning.
  3. Unannotated or retry-permissive skill instructions: Without explicit Action Annotations (Destructive) on the Custom Agent Action and a single-call guard in the .agentskill Steps prompt, the agent treats the initiation tool as safe to retry automatically when any field in the response looks incomplete.

Returning the Change Job event WID cleanly from the End step

If your Custom Agent uses a Custom Agent Action orchestration to call the Staffing REST POST /workers/{ID}/businessProcessEvents (initiate_change_job) or the Staffing SOAP Change_Job_Request / Contract_Contingent_Worker_Request web service, make sure the orchestration extracts the created business process event WID and exposes it as a documented output property on the End step:

  1. In Orchestration Builder, extract the event WID after the Initiate_Change_Job Send Workday API Request step using a Create Values step:
    javascript
    // For REST response JSON:
    data.InitiateChangeJob.response.asJSON().stringAtJsonPath("$.id")
    
    // For SOAP response XML:
    data.InitiateChangeJob.response.asXML().stringAtXpathWithDefault("//wd:Job_Application_Event_Reference/wd:ID[@wd:type='WID'] | //wd:Event_Reference/wd:ID[@wd:type='WID']", "")
  2. On the orchestration’s End step, click Configure Response.
  3. On the Body tab, add explicit output parameters: changeJobEventWid (String), status (String), and errorMessage (String).
  4. Switch to the Custom Agent Actions tab on the End step and write a clear description for each output property:
    • changeJobEventWid: The 32-character Workday ID (WID) of the newly initiated Change Job business process event. If this value is populated, the Change Job event has already been created in the tenant and MUST NOT be initiated again.
    • status: Returns INITIATED when the Change Job event was created, or FAILED if Workday rejected the initiation.

Guarding against retries in Orchestrate and .agentskill

1. Set the Action Annotation to Destructive

On the orchestration’s Start step > Configure Request > Custom Agent Actions tab, set Action Annotations to Destructive (and never Read-Only). Workday Custom Agents prompt the user to approve every call to a non-Read-Only action, which prevents the model from firing a second silent retry loop in the background without human confirmation.

2. Check for an existing in-progress Change Job event before initiating

Inside your Custom Agent Action orchestration, add a lightweight WQL pre-check before the Initiate_Change_Job step to see if the contingent worker already has an in-progress Change Job event created today:

sql
SELECT workdayID, businessProcessTransactions{workdayID, overallStatus, transactionEffectiveMoment}
FROM workersForHCMReporting
WHERE workdayID = '{{lp.getSimpleData("workerWid")}}'

If an in-progress Change Job event already exists for that worker and effective date, return its existing workdayID in changeJobEventWid with status = "ALREADY_INITIATED" instead of creating a duplicate event.

3. Add a strict single-invocation rule to .agentskill

In your .agentskill file, instruct the model never to call initiate_change_job more than once per request:

markdown
## Steps

1. Confirm the contingent worker's `workerWid` and the new `contractEndDate` (YYYY-MM-DD) with the user.
2. Call `initiate_change_job` **at most once**.
3. Inspect the tool output:
   - If `changeJobEventWid` is returned, proceed to update the contract end date using that WID.
   - If `initiate_change_job` returns an error or an empty `changeJobEventWid`, **stop immediately**, report the exact error message to the user, and do **not** call `initiate_change_job` a second time.

Also ensure any required prompt lookup tools (such as Change Job Reason prompt WIDs) are included in tool-wids alongside the write tool so the initiation doesn’t fail mid-flight on an invalid reason reference.

Verifying the fix in your tenant

Open your Agent app in App Builder, trigger the contract end date change in Workday Chat, and open the Agent Traces tab at the bottom of App Builder. Click View Trace Details on the run and expand the AviatoTurboChatCIS node. In the Outputs section, verify that initiate_change_job appears only once in the tool call list and that its tool response includes the populated changeJobEventWid. Finally, open the contingent worker’s Worker History in the tenant to confirm that only a single Change Job business process event was created.

Sources checked

Related guides

All guides

Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.

We’ll email you once to confirm. Unsubscribe in one click from any issue.