@salesforce/b2c-tooling-sdk / operations/ods / waitForSandbox
Function: waitForSandbox()
waitForSandbox(
client,options):Promise<void>
Defined in: packages/b2c-tooling-sdk/src/operations/ods/wait-for-sandbox.ts:100
Waits for a sandbox to reach a target state by polling its status.
This function polls the ODS API at regular intervals until the sandbox reaches the desired state, times out, or enters a terminal error state (failed/deleted).
Parameters
client
ODS client for API calls
options
Polling configuration options
Returns
Promise<void>
Throws
If the timeout is exceeded before reaching target state
Throws
If the API request fails
Throws
If the sandbox enters a terminal error state
Example
typescript
await waitForSandbox(odsClient, {
sandboxId: 'abc-123',
targetState: 'started',
pollIntervalSeconds: 5,
timeoutSeconds: 300,
onPoll: (info) => console.log(`State: ${info.state} (${info.elapsedSeconds}s)`),
});