Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(workday): search, fetch and watch 15 Workday objects through Workday Web Services (#16564)

Kishan Parmar1fa4bfd7aa9c
diff --git a/bun.lock b/bun.lock
index e4bbf4f1fd1..713d7a862db 100644
--- a/bun.lock
+++ b/bun.lock
@@ -10091,7 +10091,7 @@
},
"packages/pieces/community/workday": {
"name": "@activepieces/piece-workday",
- "version": "0.2.0",
+ "version": "0.3.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/workday/package.json b/packages/pieces/community/workday/package.json
index 0df11ed2b5e..87fb8223cf1 100644
--- a/packages/pieces/community/workday/package.json
+++ b/packages/pieces/community/workday/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-workday",
- "version": "0.2.1",
+ "version": "0.3.0",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/workday/src/lib/actions/call-operation.ts b/packages/pieces/community/workday/src/lib/actions/call-operation.ts
index aaadf352fd2..63f0d8829f9 100644
--- a/packages/pieces/community/workday/src/lib/actions/call-operation.ts
+++ b/packages/pieces/community/workday/src/lib/actions/call-operation.ts
@@ -6,6 +6,29 @@ import { workdayApi } from '../common/api';
import { workdayProps } from '../common/props';
import { workdayUtils } from '../common/utils';
+const SOAP_SERVICES = [
+ 'Absence_Management',
+ 'Benefits_Administration',
+ 'Cash_Management',
+ 'Compensation',
+ 'Compensation_Review',
+ 'Financial_Management',
+ 'Human_Resources',
+ 'Identity_Management',
+ 'Integrations',
+ 'Learning',
+ 'Payroll',
+ 'Payroll_Interface',
+ 'Performance_Management',
+ 'Recruiting',
+ 'Resource_Management',
+ 'Revenue_Management',
+ 'Staffing',
+ 'Talent',
+ 'Time_Tracking',
+ 'Workforce_Planning',
+];
+
export const callOperationAction = createAction({
auth: workdayAuth,
name: 'call_operation',
@@ -39,9 +62,22 @@ export const callOperationAction = createAction({
'REST sub-resource or SOAP operation path, e.g. `/cases/{id}/reopen` or `Close_Job_Requisition`.',
required: true,
}),
- soapService: Property.ShortText({
- displayName: 'SOAP Service Name',
- description: 'Required for SOAP operations, e.g. `Staffing` or `Human_Resources`.',
+ soapService: Property.StaticDropdown({
+ displayName: 'SOAP Service',
+ description: 'Workday Web Service that owns the operation. Required for SOAP operations.',
+ required: false,
+ options: {
+ disabled: false,
+ options: SOAP_SERVICES.map((service) => ({
+ label: service.replace(/_/g, ' '),
+ value: service,
+ })),
+ },
+ }),
+ soapVersion: Property.ShortText({
+ displayName: 'SOAP Version',
+ description:
+ 'Workday Web Services version for this call, e.g. `v45.0`. Leave empty to use the connection version (default v47.0).',
required: false,
}),
httpMethod: Property.StaticDropdown<HttpMethod, false>({
@@ -72,7 +108,7 @@ export const callOperationAction = createAction({
async run({ auth, propsValue }) {
if (propsValue.operationType === 'soap') {
if (!propsValue.soapService) {
- throw new Error('SOAP Service Name is required for SOAP operations.');
+ throw new Error('SOAP Service is required for SOAP operations.');
}
const xml =
propsValue.soapBody && propsValue.soapBody.trim().length > 0
@@ -82,6 +118,7 @@ export const callOperationAction = createAction({
auth,
service: propsValue.soapService,
operationXml: xml,
+ version: propsValue.soapVersion,
});
return workdayUtils.flattenRecord({ value: result });
}
diff --git a/packages/pieces/community/workday/src/lib/actions/get-business-object-details-batch.ts b/packages/pieces/community/workday/src/lib/actions/get-business-object-details-batch.ts
index 0b7d051d5f0..a6506de61df 100644
--- a/packages/pieces/community/workday/src/lib/actions/get-business-object-details-batch.ts
+++ b/packages/pieces/community/workday/src/lib/actions/get-business-object-details-batch.ts
@@ -14,15 +14,21 @@ export const getBusinessObjectDetailsBatchAction = createAction({
audience: 'both',
aiMetadata: {
description:
- 'Fetches the full record for one or more Workday business objects by ID in a single step, after selecting the module (Recruiting, Onboarding, or HR Services & Time Tracking) and an object type (Worker, Case, or Time Entry), or supplying a custom REST path instead. Use when the record IDs are already known; use Search Business Object (Batch) to find records by criteria. Read-only and idempotent.',
+ "Fetches the full record for one or more Workday business objects by ID in a single step, for one object type. With the SOAP source (the default, needs ISU credentials) it fetches all IDs in one request for Worker, Organization, Job Profile, Location, Job Family, Job Family Group, Job Classification Group, Position, Worker Document, Citizenship Status, Job Requisition, Evergreen Requisition, Applicant, Payee, or Customer Contract; IDs may be WIDs or the object ID (e.g. Employee ID), and an unknown ID fails the step with Workday's error. With the REST source it reads a module's Worker, Case, or Time Entry record or a custom REST path. Use when the record IDs are already known; use Search Business Object (Batch) to find records by criteria. Read-only and idempotent.",
idempotent: true,
},
props: {
- module: workdayProps.module({ required: true }),
+ source: workdayProps.source({ required: false }),
+ module: workdayProps.module({
+ required: false,
+ description:
+ 'Workday functional area: Recruiting, Onboarding, or HR Services & Time Tracking. Only used with the REST source.',
+ }),
businessObject: workdayProps.businessObject({ required: true }),
objectIds: Property.Array({
displayName: 'Object IDs',
- description: 'One or more Workday record IDs to retrieve.',
+ description:
+ 'One or more record IDs to retrieve: WIDs, or with the SOAP source also the object ID (e.g. Employee ID for workers).',
required: true,
properties: {
id: Property.ShortText({
@@ -33,14 +39,30 @@ export const getBusinessObjectDetailsBatchAction = createAction({
}),
},
async run({ auth, propsValue }) {
+ const ids = propsValue.objectIds.flatMap((item) =>
+ typeof item === 'object' && item !== null && 'id' in item ? [String(item.id)] : [],
+ );
+ if (ids.length === 0) {
+ return { total_count: 0, records: [] };
+ }
+ if (propsValue.source === 'wws') {
+ const soapRecords = await workdayApi.listSoapObjects({
+ auth,
+ object: workdayUtils.resolveSoapObject({
+ value: propsValue.businessObject['objectType'],
+ }),
+ ids,
+ });
+ return {
+ total_count: soapRecords.length,
+ records: soapRecords,
+ };
+ }
const businessObject = workdayUtils.resolveBusinessObject({
module: propsValue.module,
selection: propsValue.businessObject,
});
- const module = workdayUtils.toWorkdayModule({ module: propsValue.module });
- const ids = propsValue.objectIds.flatMap((item) =>
- typeof item === 'object' && item !== null && 'id' in item ? [String(item.id)] : [],
- );
+ const module = workdayUtils.toWorkdayModule({ module: propsValue.module ?? '' });
const records = await Promise.all(
ids.map(async (id) => {
diff --git a/packages/pieces/community/workday/src/lib/actions/search-business-object-batch.ts b/packages/pieces/community/workday/src/lib/actions/search-business-object-batch.ts
index c6503dacb93..73e3633027e 100644
--- a/packages/pieces/community/workday/src/lib/actions/search-business-object-batch.ts
+++ b/packages/pieces/community/workday/src/lib/actions/search-business-object-batch.ts
@@ -14,24 +14,50 @@ export const searchBusinessObjectBatchAction = createAction({
audience: 'both',
aiMetadata: {
description:
- 'Pages through a Workday business object collection and returns every matching record, after selecting the module (Recruiting, Onboarding, or HR Services & Time Tracking) and an object type (Worker, Case, or Time Entry), or supplying a custom REST path instead. Optional JSON query parameters narrow the results; omitting them returns all records of that type. Use to find records by criteria, and Get Business Object Details (Batch) when the IDs are already known. Read-only and idempotent.',
+ "Pages through a Workday business object collection and returns every matching record, for one object type. With the SOAP source (the default, needs ISU credentials) it lists records of Worker, Organization, Job Profile, Location, Job Family, Job Family Group, Job Classification Group, Position, Worker Document, Citizenship Status, Job Requisition, Evergreen Requisition, Applicant, or Customer Contract, up to the Limit (default 100, max 1000); Payees can only be fetched by ID with Get Business Object Details. With the REST source it pages a module's Worker, Case, or Time Entry collection or a custom REST path, and optional JSON query parameters narrow the results. Use to find records by criteria, and Get Business Object Details (Batch) when the IDs are already known. Read-only and idempotent.",
idempotent: true,
},
props: {
- module: workdayProps.module({ required: true }),
+ source: workdayProps.source({ required: false }),
+ module: workdayProps.module({
+ required: false,
+ description:
+ 'Workday functional area: Recruiting, Onboarding, or HR Services & Time Tracking. Only used with the REST source.',
+ }),
businessObject: workdayProps.businessObject({ required: true }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description:
+ 'Maximum number of records to return with the SOAP source (default 100, max 1000). Workday records are large, so keep this low.',
+ required: false,
+ defaultValue: 100,
+ }),
queryParams: Property.Json({
displayName: 'Query Parameters (JSON)',
- description: 'Optional REST query parameters, e.g. `{ "limit": 50, "status": "Open" }`.',
+ description:
+ 'Optional REST query parameters, e.g. `{ "limit": 50, "status": "Open" }`. Only used with the REST source.',
required: false,
}),
},
async run({ auth, propsValue }) {
+ if (propsValue.source === 'wws') {
+ const records = await workdayApi.listSoapObjects({
+ auth,
+ object: workdayUtils.resolveSoapObject({
+ value: propsValue.businessObject['objectType'],
+ }),
+ limit: Math.min(Math.max(propsValue.limit ?? 100, 1), 1000),
+ });
+ return {
+ total_count: records.length,
+ records,
+ };
+ }
const businessObject = workdayUtils.resolveBusinessObject({
module: propsValue.module,
selection: propsValue.businessObject,
});
- const module = workdayUtils.toWorkdayModule({ module: propsValue.module });
+ const module = workdayUtils.toWorkdayModule({ module: propsValue.module ?? '' });
const records = await workdayApi.searchBusinessObjects({
auth,
diff --git a/packages/pieces/community/workday/src/lib/common/api.ts b/packages/pieces/community/workday/src/lib/common/api.ts
index 7dc601d2797..c45936e83d6 100644
--- a/packages/pieces/community/workday/src/lib/common/api.ts
+++ b/packages/pieces/community/workday/src/lib/common/api.ts
@@ -11,6 +11,9 @@ import type {
WorkdayPage,
WorkdayRecord,
WorkdayReport,
+ WorkdayServerTimestampBody,
+ WorkdaySoapGetPage,
+ WorkdaySoapObject,
WorkdaySupplierInvoicesBody,
} from './types';
@@ -132,6 +135,115 @@ async function listBusinessObjects({
return page.data ?? [];
}
+async function listSoapObjects({
+ auth,
+ object,
+ ids,
+ updatedFrom,
+ updatedThrough,
+ limit,
+}: {
+ auth: WorkdayAuthValue;
+ object: WorkdaySoapObject;
+ ids?: string[];
+ updatedFrom?: string;
+ updatedThrough?: string;
+ limit?: number;
+}): Promise<WorkdayRecord[]> {
+ if (object.idsRequired && (!ids || ids.length === 0)) {
+ throw new Error(
+ `${object.label} can only be fetched by ID. Use Get Business Object Details.`,
+ );
+ }
+ const first = await getSoapObjectsPage({
+ auth,
+ object,
+ ids,
+ updatedFrom,
+ updatedThrough,
+ });
+ const lastPage = limit
+ ? Math.min(first.totalPages, Math.ceil(limit / SOAP_PAGE_SIZE))
+ : first.totalPages;
+ const rest = [];
+ for (let page = 2; page <= lastPage; page++) {
+ const next = await getSoapObjectsPage({
+ auth,
+ object,
+ ids,
+ updatedFrom,
+ updatedThrough,
+ page,
+ asOfEntryDateTime: first.asOfEntryDateTime,
+ });
+ rest.push(...next.records);
+ }
+ const records = [...first.records, ...rest];
+ return limit ? records.slice(0, limit) : records;
+}
+
+async function listChangedSoapObjects({
+ auth,
+ object,
+ sinceEpochMS,
+}: {
+ auth: WorkdayAuthValue;
+ object: WorkdaySoapObject;
+ sinceEpochMS: number;
+}): Promise<{ records: WorkdayRecord[]; updatedThroughEpochMS: number }> {
+ if (!object.transactionLog) {
+ throw new Error(`Workday does not track changes for ${object.label}, so it can't be watched.`);
+ }
+ const isTest = sinceEpochMS === 0;
+ const updatedThrough = await getServerTime({ auth });
+ const updatedFrom = isTest ? updatedThrough.subtract(7, 'day') : dayjs(sinceEpochMS);
+ const records = await listSoapObjects({
+ auth,
+ object,
+ updatedFrom: updatedFrom.toISOString(),
+ updatedThrough: updatedThrough.toISOString(),
+ limit: isTest ? 10 : undefined,
+ });
+ return {
+ records,
+ updatedThroughEpochMS: updatedThrough.valueOf(),
+ };
+}
+
+async function getServerTime({ auth }: { auth: WorkdayAuthValue }): Promise<dayjs.Dayjs> {
+ const body = await workdayClient.soap<WorkdayServerTimestampBody>({
+ auth,
+ service: 'Human_Resources',
+ operationXml: '<bsvc:Server_Timestamp_Get xmlns:bsvc="urn:com.workday/bsvc"/>',
+ });
+ const serverTime = dayjs(body.Server_Timestamp?.Server_Timestamp_Data);
+ if (!serverTime.isValid()) {
+ throw new Error('Workday did not return its current time.');
+ }
+ return serverTime;
+}
+
+async function getSoapObjectsPage({
+ auth,
+ object,
+ ...request
+}: {
+ auth: WorkdayAuthValue;
+ object: WorkdaySoapObject;
+ ids?: string[];
+ updatedFrom?: string;
+ updatedThrough?: string;
+ page?: number;
+ asOfEntryDateTime?: string;
+}): Promise<WorkdaySoapGetPage> {
+ const body = await workdayClient.soap({
+ auth,
+ service: object.service,
+ operationXml: workdayUtils.buildSoapGetRequest({ object, ...request }),
+ });
+ return workdayUtils.readSoapGetPage({ object, body });
+}
+
async function updateBusinessObject({
auth,
businessObject,
@@ -172,12 +284,14 @@ async function callSoapOperation({
auth,
service,
operationXml,
+ version,
}: {
auth: WorkdayAuthValue;
service: string;
operationXml: string;
+ version?: string;
}): Promise<WorkdayRecord> {
- return await workdayClient.soap({ auth, service, operationXml });
+ return await workdayClient.soap({ auth, service, operationXml, version });
}
async function runWql({
@@ -1085,6 +1199,8 @@ export const workdayApi = {
getBusinessObject,
searchBusinessObjects,
listBusinessObjects,
+ listSoapObjects,
+ listChangedSoapObjects,
updateBusinessObject,
callRestOperation,
callSoapOperation,
@@ -1112,3 +1228,4 @@ export const workdayApi = {
};
const WID_PATTERN = /^[0-9a-f]{32}$/i;
+const SOAP_PAGE_SIZE = 100;
diff --git a/packages/pieces/community/workday/src/lib/common/client.ts b/packages/pieces/community/workday/src/lib/common/client.ts
index ede9178761d..2e0995fcaa4 100644
--- a/packages/pieces/community/workday/src/lib/common/client.ts
+++ b/packages/pieces/community/workday/src/lib/common/client.ts
@@ -136,6 +136,7 @@ async function soap<T extends WorkdayRecord = WorkdayRecord>({
auth,
service,
operationXml,
+ version,
}: SoapParams & { auth: WorkdayAuthValue }): Promise<T> {
const { username, password } = isuCredentials({ auth });
const envelope = buildSoapEnvelope({
@@ -146,8 +147,11 @@ async function soap<T extends WorkdayRecord = WorkdayRecord>({
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
- url: `https://${apiHost({ auth })}/ccx/service/${tenant({ auth })}/${service}/${wwsVersion({
+ url: `https://${apiHost({ auth })}/ccx/service/${tenant({
auth,
+ })}/${service}/${wwsVersion({
+ auth,
+ version,
})}`,
headers: {
'Content-Type': 'text/xml;charset=UTF-8',
@@ -159,6 +163,7 @@ async function soap<T extends WorkdayRecord = WorkdayRecord>({
ignoreAttributes: false,
removeNSPrefix: true,
parseAttributeValue: true,
+ numberParseOptions: { leadingZeros: false, hex: false },
});
const parsed: WorkdaySoapEnvelope<T> = parser.parse(
@@ -206,8 +211,17 @@ function readConnectionProp({
return typeof value === 'string' ? value : undefined;
}
-function wwsVersion({ auth }: { auth: WorkdayAuthValue }): string {
- const version = readConnectionProp({ auth, key: 'wwsVersion' })?.trim() || DEFAULT_WWS_VERSION;
+function wwsVersion({
+ auth,
+ version: override,
+}: {
+ auth: WorkdayAuthValue;
+ version?: string;
+}): string {
+ const version =
+ override?.trim() ||
+ readConnectionProp({ auth, key: 'wwsVersion' })?.trim() ||
+ DEFAULT_WWS_VERSION;
if (!/^v\d+(\.\d+)?$/.test(version)) {
throw new Error(`WWS Version "${version}" is not valid. Use a version like v47.0.`);
}
@@ -309,6 +323,7 @@ type WqlParams = {
type SoapParams = {
service: string;
operationXml: string;
+ version?: string;
};
type ReportParams = {
diff --git a/packages/pieces/community/workday/src/lib/common/props.ts b/packages/pieces/community/workday/src/lib/common/props.ts
index 87d62e04476..b4070b61ae6 100644
--- a/packages/pieces/community/workday/src/lib/common/props.ts
+++ b/packages/pieces/community/workday/src/lib/common/props.ts
@@ -25,18 +25,44 @@ function module<R extends boolean>({
});
}
+function source<R extends boolean>({
+ required,
+ displayName = 'Source',
+ description = 'Workday Web Services (SOAP) reaches every object in the list and needs ISU credentials on the connection. REST covers fewer objects.',
+}: PropParams<R>) {
+ return Property.StaticDropdown({
+ displayName,
+ description,
+ required,
+ defaultValue: 'wws',
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Workday Web Services (SOAP)', value: 'wws' },
+ { label: 'REST', value: 'rest' },
+ ],
+ },
+ });
+}
+
function businessObject<R extends boolean>({
required,
displayName = 'Business Object',
description,
-}: PropParams<R>) {
+ changeTrackingOnly = false,
+}: PropParams<R> & { changeTrackingOnly?: boolean }) {
return Property.DynamicProperties({
displayName,
description,
required,
- refreshers: ['module'],
+ refreshers: ['source', 'module'],
auth: workdayAuth,
- props: async ({ module }): Promise<DynamicPropsValue> => {
+ props: async ({ source, module }): Promise<DynamicPropsValue> => {
+ if (source === 'wws') {
+ return {
+ objectType: soapBusinessObjectType({ changeTrackingOnly }),
+ };
+ }
if (typeof module !== 'string' || !module) {
return {
objectType: Property.ShortText({
@@ -151,6 +177,22 @@ function businessObjectType({ module }: { module: string }) {
});
}
+function soapBusinessObjectType({ changeTrackingOnly }: { changeTrackingOnly: boolean }) {
+ return Property.StaticDropdown({
+ displayName: 'Business Object',
+ description: changeTrackingOnly
+ ? 'Workday business object to watch. Only objects whose changes Workday tracks are listed.'
+ : 'Workday business object to work with.',
+ required: true,
+ options: {
+ disabled: false,
+ options: workdayUtils
+ .soapObjects({ transactionLogOnly: changeTrackingOnly })
+ .map((item) => ({ label: item.label, value: item.value })),
+ },
+ });
+}
+
function customBusinessObjectPath() {
return Property.ShortText({
displayName: 'Custom Business Object Path',
@@ -185,6 +227,7 @@ function disabledOptions({ placeholder }: { placeholder: string }): DropdownStat
}
export const workdayProps = {
+ source,
module,
businessObject,
customObjectDefinition,
diff --git a/packages/pieces/community/workday/src/lib/common/types.ts b/packages/pieces/community/workday/src/lib/common/types.ts
index 8a7b273ef8c..d5ed86c8146 100644
--- a/packages/pieces/community/workday/src/lib/common/types.ts
+++ b/packages/pieces/community/workday/src/lib/common/types.ts
@@ -29,6 +29,26 @@ export type WorkdayBusinessObject = {
wqlDataSource?: string;
};
+export type WorkdaySoapObject = {
+ label: string;
+ value: string;
+ service: string;
+ operation: string;
+ referenceElement: string;
+ idType: string;
+ recordElement: string;
+ referencesInCriteria?: boolean;
+ idsRequired?: boolean;
+ transactionLog?: boolean;
+ responseGroup?: string[];
+};
+
+export type WorkdaySoapGetPage = {
+ records: WorkdayRecord[];
+ totalPages: number;
+ asOfEntryDateTime?: string;
+};
+
export type WorkdayRecord = Record<string, unknown>;
export type WorkdayPage<T> = {
@@ -51,6 +71,12 @@ export type WorkdaySoapEnvelope<T extends WorkdayRecord> = {
};
};
+export type WorkdayServerTimestampBody = {
+ Server_Timestamp?: {
+ Server_Timestamp_Data?: string;
+ };
+};
+
export type WorkdaySupplierInvoicesBody = {
Get_Supplier_Invoices_Response?: {
Response_Data?: {
diff --git a/packages/pieces/community/workday/src/lib/common/utils.ts b/packages/pieces/community/workday/src/lib/common/utils.ts
index a439fbcce33..469d5c638d4 100644
--- a/packages/pieces/community/workday/src/lib/common/utils.ts
+++ b/packages/pieces/community/workday/src/lib/common/utils.ts
@@ -1,6 +1,12 @@
import type { QueryParams } from '@activepieces/pieces-common';
-import type { WorkdayBusinessObject, WorkdayModule, WorkdayRecord } from './types';
+import type {
+ WorkdayBusinessObject,
+ WorkdayModule,
+ WorkdayRecord,
+ WorkdaySoapGetPage,
+ WorkdaySoapObject,
+} from './types';
function escapeXml({ value }: { value: string }): string {
return value
@@ -164,6 +170,153 @@ function toQueryParams({ value }: { value: WorkdayRecord | undefined }): QueryPa
return Object.fromEntries(Object.entries(value ?? {}).map(([key, item]) => [key, String(item)]));
}
+function soapObjects({
+ transactionLogOnly,
+}: {
+ transactionLogOnly?: boolean;
+}): WorkdaySoapObject[] {
+ return transactionLogOnly ? SOAP_OBJECTS.filter((item) => item.transactionLog) : SOAP_OBJECTS;
+}
+
+function resolveSoapObject({ value }: { value: unknown }): WorkdaySoapObject {
+ const found = SOAP_OBJECTS.find((item) => item.value === value);
+ if (!found) {
+ throw new Error('Select a valid business object.');
+ }
+ return found;
+}
+
+function buildSoapGetRequest({
+ object,
+ ids = [],
+ updatedFrom,
+ updatedThrough,
+ page,
+ asOfEntryDateTime,
+}: {
+ object: WorkdaySoapObject;
+ ids?: string[];
+ updatedFrom?: string;
+ updatedThrough?: string;
+ page?: number;
+ asOfEntryDateTime?: string;
+}): string {
+ const references = ids
+ .map((id) => {
+ const idType = WID_PATTERN.test(id) ? 'WID' : object.idType;
+ return `<bsvc:${object.referenceElement}><bsvc:ID bsvc:type="${idType}">${escapeXml({
+ value: id,
+ })}</bsvc:ID></bsvc:${object.referenceElement}>`;
+ })
+ .join('');
+ const transactionLog =
+ updatedFrom && updatedThrough
+ ? `<bsvc:Transaction_Log_Criteria_Data><bsvc:Transaction_Date_Range_Data><bsvc:Updated_From>${escapeXml(
+ { value: updatedFrom },
+ )}</bsvc:Updated_From><bsvc:Updated_Through>${escapeXml({
+ value: updatedThrough,
+ })}</bsvc:Updated_Through></bsvc:Transaction_Date_Range_Data></bsvc:Transaction_Log_Criteria_Data>`
+ : '';
+ const criteria = object.referencesInCriteria ? `${transactionLog}${references}` : transactionLog;
+ const filter = [
+ asOfEntryDateTime
+ ? `<bsvc:As_Of_Entry_DateTime>${escapeXml({
+ value: asOfEntryDateTime,
+ })}</bsvc:As_Of_Entry_DateTime>`
+ : '',
+ page ? `<bsvc:Page>${page}</bsvc:Page>` : '',
+ `<bsvc:Count>${SOAP_PAGE_SIZE}</bsvc:Count>`,
+ ].join('');
+ const responseGroup = object.responseGroup
+ ? `<bsvc:Response_Group>${object.responseGroup
+ .map((flag) => `<bsvc:${flag}>true</bsvc:${flag}>`)
+ .join('')}</bsvc:Response_Group>`
+ : '';
+ return [
+ `<bsvc:${object.operation}_Request xmlns:bsvc="urn:com.workday/bsvc">`,
+ references && !object.referencesInCriteria
+ ? `<bsvc:Request_References>${references}</bsvc:Request_References>`
+ : '',
+ criteria ? `<bsvc:Request_Criteria>${criteria}</bsvc:Request_Criteria>` : '',
+ `<bsvc:Response_Filter>${filter}</bsvc:Response_Filter>`,
+ responseGroup,
+ `</bsvc:${object.operation}_Request>`,
+ ].join('');
+}
+
+function readSoapGetPage({
+ object,
+ body,
+}: {
+ object: WorkdaySoapObject;
+ body: WorkdayRecord;
+}): WorkdaySoapGetPage {
+ const response = asRecord({ value: body[`${object.operation}_Response`] });
+ const results = asRecord({ value: response['Response_Results'] });
+ const filter = asRecord({ value: response['Response_Filter'] });
+ const data = asRecord({ value: response['Response_Data'] });
+ const records = toArray({ value: data[object.recordElement] }).map((record) =>
+ simplifySoapValue({ value: record }),
+ );
+ const asOf = filter['As_Of_Entry_DateTime'];
+ return {
+ records: records
+ .filter((record): record is WorkdayRecord => isPlainRecord(record))
+ .map((record) => ({
+ id: asRecord({ value: record[`${object.recordElement}_Reference`] })['WID'],
+ ...record,
+ })),
+ totalPages: Number(results['Total_Pages'] ?? 1) || 1,
+ asOfEntryDateTime: typeof asOf === 'string' ? asOf : undefined,
+ };
+}
+
+function simplifySoapValue({ value }: { value: unknown }): unknown {
+ if (Array.isArray(value)) {
+ return value.map((item) => simplifySoapValue({ value: item }));
+ }
+ if (!isPlainRecord(value)) {
+ return value;
+ }
+ const ids = value['ID'];
+ if (
+ ids !== undefined &&
+ Object.keys(value).every((key) => key === 'ID' || key.startsWith('@_'))
+ ) {
+ const entries = toArray({ value: ids }).flatMap((id) =>
+ isPlainRecord(id) && typeof id['@_type'] === 'string'
+ ? [[id['@_type'], String(id['#text'])]]
+ : [],
+ );
+ const descriptor = value['@_Descriptor'];
+ return {
+ ...Object.fromEntries(entries),
+ ...(typeof descriptor === 'string' ? { descriptor } : {}),
+ };
+ }
+ return Object.fromEntries(
+ Object.entries(value).map(([key, nested]) => [
+ key.startsWith('@_') ? key.slice(2) : key,
+ simplifySoapValue({ value: nested }),
+ ]),
+ );
+}
+
+function toArray({ value }: { value: unknown }): unknown[] {
+ if (value === undefined || value === null) {
+ return [];
+ }
+ return Array.isArray(value) ? value : [value];
+}
+
+function asRecord({ value }: { value: unknown }): WorkdayRecord {
+ return isPlainRecord(value) ? value : {};
+}
+
+function isPlainRecord(value: unknown): value is WorkdayRecord {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+}
+
function businessObjectsForModule({ module }: { module: string }): WorkdayBusinessObject[] {
return BUSINESS_OBJECTS_BY_MODULE[module] ?? [];
}
@@ -223,10 +376,179 @@ export const workdayUtils = {
businessObjectsForModule,
resolveBusinessObject,
toWorkdayModule,
+ soapObjects,
+ resolveSoapObject,
+ buildSoapGetRequest,
+ readSoapGetPage,
};
const MAX_FLATTEN_DEPTH = 4;
const CUSTOM_BUSINESS_OBJECT = '__custom__';
+const SOAP_PAGE_SIZE = 100;
+const WID_PATTERN = /^[0-9a-f]{32}$/i;
+
+const SOAP_OBJECTS: WorkdaySoapObject[] = [
+ {
+ label: 'Worker',
+ value: 'workers',
+ service: 'Human_Resources',
+ operation: 'Get_Workers',
+ referenceElement: 'Worker_Reference',
+ idType: 'Employee_ID',
+ recordElement: 'Worker',
+ transactionLog: true,
+ responseGroup: [
+ 'Include_Reference',
+ 'Include_Personal_Information',
+ 'Include_Employment_Information',
+ ],
+ },
+ {
+ label: 'Organization',
+ value: 'organizations',
+ service: 'Human_Resources',
+ operation: 'Get_Organizations',
+ referenceElement: 'Organization_Reference',
+ idType: 'Organization_Reference_ID',
+ recordElement: 'Organization',
+ },
+ {
+ label: 'Job Profile',
+ value: 'job_profiles',
+ service: 'Human_Resources',
+ operation: 'Get_Job_Profiles',
+ referenceElement: 'Job_Profile_Reference',
+ idType: 'Job_Profile_ID',
+ recordElement: 'Job_Profile',
+ transactionLog: true,
+ responseGroup: ['Include_Reference', 'Include_Job_Profile_Basic_Data'],
+ },
+ {
+ label: 'Location',
+ value: 'locations',
+ service: 'Human_Resources',
+ operation: 'Get_Locations',
+ referenceElement: 'Location_Reference',
+ idType: 'Location_ID',
+ recordElement: 'Location',
+ responseGroup: ['Include_Reference', 'Include_Location_Data'],
+ },
+ {
+ label: 'Job Family',
+ value: 'job_families',
+ service: 'Human_Resources',
+ operation: 'Get_Job_Families',
+ referenceElement: 'Job_Family_Reference',
+ idType: 'Job_Family_ID',
+ recordElement: 'Job_Family',
+ },
+ {
+ label: 'Job Family Group',
+ value: 'job_family_groups',
+ service: 'Human_Resources',
+ operation: 'Get_Job_Family_Groups',
+ referenceElement: 'Job_Family_Group_Reference',
+ idType: 'Job_Family_ID',
+ recordElement: 'Job_Family_Group',
+ },
+ {
+ label: 'Job Classification Group',
+ value: 'job_classification_groups',
+ service: 'Human_Resources',
+ operation: 'Get_Job_Classification_Groups',
+ referenceElement: 'Job_Classification_Group_Reference',
+ idType: 'Job_Classification_Group_ID',
+ recordElement: 'Job_Classification_Group',
+ },
+ {
+ label: 'Position',
+ value: 'positions',
+ service: 'Staffing',
+ operation: 'Get_Positions',
+ referenceElement: 'Positions_Reference',
+ idType: 'Position_ID',
+ recordElement: 'Position',
+ transactionLog: true,
+ responseGroup: ['Include_Reference', 'Include_Position_Definition_Data'],
+ },
+ {
+ label: 'Worker Document',
+ value: 'worker_documents',
+ service: 'Staffing',
+ operation: 'Get_Worker_Documents',
+ referenceElement: 'Worker_Document_Reference',
+ idType: 'File_ID',
+ recordElement: 'Worker_Document',
+ responseGroup: ['Include_Reference'],
+ },
+ {
+ label: 'Citizenship Status',
+ value: 'citizenship_statuses',
+ service: 'Staffing',
+ operation: 'Get_Citizenship_Statuses',
+ referenceElement: 'Citizenship_Status_Reference',
+ idType: 'Citizenship_Status_Code',
+ recordElement: 'Citizenship_Status',
+ },
+ {
+ label: 'Job Requisition',
+ value: 'job_requisitions',
+ service: 'Recruiting',
+ operation: 'Get_Job_Requisitions',
+ referenceElement: 'Job_Requisition_Reference',
+ idType: 'Job_Requisition_ID',
+ recordElement: 'Job_Requisition',
+ transactionLog: true,
+ responseGroup: ['Include_Reference', 'Include_Job_Requisition_Definition_Data'],
+ },
+ {
+ label: 'Evergreen Requisition',
+ value: 'evergreen_requisitions',
+ service: 'Recruiting',
+ operation: 'Get_Evergreen_Requisitions',
+ referenceElement: 'Evergreen_Job_Requisition_Reference',
+ idType: 'Job_Requisition_ID',
+ recordElement: 'Evergreen_Job_Requisition',
+ transactionLog: true,
+ responseGroup: ['Include_Reference', 'Include_Job_Requisition_Definition_Data'],
+ },
+ {
+ label: 'Applicant',
+ value: 'applicants',
+ service: 'Recruiting',
+ operation: 'Get_Applicants',
+ referenceElement: 'Applicant_Reference',
+ idType: 'Applicant_ID',
+ recordElement: 'Applicant',
+ responseGroup: [
+ 'Include_Reference',
+ 'Include_Personal_Information',
+ 'Include_Recruiting_Information',
+ ],
+ },
+ {
+ label: 'Payee',
+ value: 'payees',
+ service: 'Payroll_Interface',
+ operation: 'Get_Payees',
+ referenceElement: 'Payee_Reference',
+ idType: 'Employee_ID',
+ recordElement: 'Payee',
+ referencesInCriteria: true,
+ idsRequired: true,
+ responseGroup: ['Include_Reference', 'Include_Payee_Personal_Information'],
+ },
+ {
+ label: 'Customer Contract',
+ value: 'customer_contracts',
+ service: 'Revenue_Management',
+ operation: 'Get_Customer_Contracts',
+ referenceElement: 'Customer_Contract_Reference',
+ idType: 'Customer_Contract_Reference_ID',
+ recordElement: 'Customer_Contract',
+ responseGroup: ['Include_Reference', 'Include_Customer_Contract_Data'],
+ },
+];
const BUSINESS_OBJECTS_BY_MODULE: Record<string, WorkdayBusinessObject[]> = {
recruiting: [],
diff --git a/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object-batch.ts b/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object-batch.ts
index c0c06daacde..55f35b89b73 100644
--- a/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object-batch.ts
+++ b/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object-batch.ts
@@ -15,11 +15,24 @@ import { workdayProps } from '../common/props';
import { workdayUtils } from '../common/utils';
const props = {
- module: workdayProps.module({ required: true }),
- businessObject: workdayProps.businessObject({ required: true }),
- dateField: workdayProps.dateField({ required: false }),
+ source: workdayProps.source({ required: false }),
+ module: workdayProps.module({
+ required: false,
+ description:
+ 'Workday functional area: Recruiting, Onboarding, or HR Services & Time Tracking. Only used with the REST source.',
+ }),
+ businessObject: workdayProps.businessObject({
+ required: true,
+ changeTrackingOnly: true,
+ }),
+ dateField: workdayProps.dateField({
+ required: false,
+ description:
+ 'Field used to detect new/updated records (e.g. `lastFunctionallyUpdated`). Only used with the REST source.',
+ }),
additionalFilters: Property.Json({
displayName: 'Additional Filters (JSON)',
+ description: 'Optional REST query parameters. Only used with the REST source.',
required: false,
}),
};
@@ -30,6 +43,24 @@ const polling: Polling<
> = {
strategy: DedupeStrategy.TIMEBASED,
items: async ({ auth, propsValue, lastFetchEpochMS }) => {
+ if (propsValue.source === 'wws') {
+ const { records, updatedThroughEpochMS } = await workdayApi.listChangedSoapObjects({
+ auth,
+ object: workdayUtils.resolveSoapObject({
+ value: propsValue.businessObject['objectType'],
+ }),
+ sinceEpochMS: lastFetchEpochMS,
+ });
+ if (records.length === 0) {
+ return [];
+ }
+ return [
+ {
+ epochMilliSeconds: updatedThroughEpochMS,
+ data: { total_count: records.length, records },
+ },
+ ];
+ }
const businessObject = workdayUtils.resolveBusinessObject({
module: propsValue.module,
selection: propsValue.businessObject,
@@ -52,7 +83,9 @@ const polling: Polling<
})
: await workdayApi.searchBusinessObjects({ auth, businessObject, query: queryParams });
- const module = workdayUtils.toWorkdayModule({ module: propsValue.module });
+ const module = workdayUtils.toWorkdayModule({
+ module: propsValue.module ?? '',
+ });
const formatted = workdayUtils.formatOutputs({ records, module });
if (formatted.length === 0) {
return [];
@@ -84,7 +117,7 @@ export const newOrUpdatedBusinessObjectBatchTrigger = createTrigger({
description: 'Triggers with a batch of new or updated business objects in a single poll cycle.',
aiMetadata: {
description:
- 'Fires once per poll cycle carrying every Workday business object created or changed since the previous poll as a single batch, for the module (Recruiting, Onboarding, or HR Services & Time Tracking) and object type selected, or for a custom REST path. Recency is judged by a configurable date field, defaulting to lastFunctionallyUpdated. Use when the whole changed set should be processed at once instead of one flow run per record.',
+ "Fires once per poll cycle carrying every Workday business object created or changed since the previous poll as a single batch. With the SOAP source (the default, needs ISU credentials) it uses Workday's transaction log for Worker, Job Profile, Position, Job Requisition, or Evergreen Requisition. With the REST source it polls a module's Worker, Case, or Time Entry collection or a custom REST path, judging recency by a configurable date field (default lastFunctionallyUpdated). Use when the whole changed set should be processed at once instead of one flow run per record.",
},
props,
sampleData: {
diff --git a/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object.ts b/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object.ts
index a83281c7304..36913902102 100644
--- a/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object.ts
+++ b/packages/pieces/community/workday/src/lib/triggers/new-or-updated-business-object.ts
@@ -15,11 +15,24 @@ import { workdayProps } from '../common/props';
import { workdayUtils } from '../common/utils';
const props = {
- module: workdayProps.module({ required: true }),
- businessObject: workdayProps.businessObject({ required: true }),
- dateField: workdayProps.dateField({ required: false }),
+ source: workdayProps.source({ required: false }),
+ module: workdayProps.module({
+ required: false,
+ description:
+ 'Workday functional area: Recruiting, Onboarding, or HR Services & Time Tracking. Only used with the REST source.',
+ }),
+ businessObject: workdayProps.businessObject({
+ required: true,
+ changeTrackingOnly: true,
+ }),
+ dateField: workdayProps.dateField({
+ required: false,
+ description:
+ 'Field used to detect new/updated records (e.g. `lastFunctionallyUpdated`). Only used with the REST source.',
+ }),
additionalFilters: Property.Json({
displayName: 'Additional Filters (JSON)',
+ description: 'Optional REST query parameters. Only used with the REST source.',
required: false,
}),
};
@@ -30,11 +43,26 @@ const polling: Polling<
> = {
strategy: DedupeStrategy.TIMEBASED,
items: async ({ auth, propsValue, lastFetchEpochMS }) => {
+ if (propsValue.source === 'wws') {
+ const { records, updatedThroughEpochMS } = await workdayApi.listChangedSoapObjects({
+ auth,
+ object: workdayUtils.resolveSoapObject({
+ value: propsValue.businessObject['objectType'],
+ }),
+ sinceEpochMS: lastFetchEpochMS,
+ });
+ return records.map((record) => ({
+ epochMilliSeconds: updatedThroughEpochMS,
+ data: record,
+ }));
+ }
const businessObject = workdayUtils.resolveBusinessObject({
module: propsValue.module,
selection: propsValue.businessObject,
});
- const module = workdayUtils.toWorkdayModule({ module: propsValue.module });
+ const module = workdayUtils.toWorkdayModule({
+ module: propsValue.module ?? '',
+ });
const isTest = lastFetchEpochMS === 0;
const updatedAfter = isTest
? dayjs().subtract(7, 'day').toISOString()
@@ -69,11 +97,10 @@ export const newOrUpdatedBusinessObjectTrigger = createTrigger({
name: 'new_or_updated_business_object',
classification: 'READ',
displayName: 'New/Updated Business Object',
- description:
- 'Triggers when a business object is created or updated in Recruiting, Onboarding, or HR Services & Time Tracking.',
+ description: 'Triggers when a Workday business object is created or updated.',
aiMetadata: {
description:
- 'Fires once per Workday business object created or changed since the last poll, for the module (Recruiting, Onboarding, or HR Services & Time Tracking) and object type selected, or for a custom REST path. Recency is judged by a configurable date field, defaulting to lastFunctionallyUpdated, and optional JSON filters narrow the polled set. Use when downstream work should run per record; use the batch variant to handle all changed records in one run.',
+ "Fires once per Workday business object created or changed since the last poll. With the SOAP source (the default, needs ISU credentials) it uses Workday's transaction log for Worker, Job Profile, Position, Job Requisition, or Evergreen Requisition. With the REST source it polls a module's Worker, Case, or Time Entry collection or a custom REST path, judging recency by a configurable date field (default lastFunctionallyUpdated) with optional JSON filters. Use when downstream work should run per record; use the batch variant to handle all changed records in one run.",
},
props,
sampleData: {
diff --git a/packages/pieces/community/workday/test/actions.test.ts b/packages/pieces/community/workday/test/actions.test.ts
index 7f3afdd6451..4bd2937ba7a 100644
--- a/packages/pieces/community/workday/test/actions.test.ts
+++ b/packages/pieces/community/workday/test/actions.test.ts
@@ -79,6 +79,17 @@ describe('get_business_object_details_batch', () => {
'https://wd2-impl-services1.workday.com/ccx/api/recruiting/v4/mytenant/jobPostings/1',
);
});
+
+ it('returns nothing for an empty ID list instead of listing every record', async () => {
+ const out = await getBusinessObjectDetailsBatchAction.run(
+ context(
+ { source: 'wws', businessObject: { objectType: 'workers' }, objectIds: [] },
+ AUTH_WITH_ISU,
+ ),
+ );
+ expect(out).toEqual({ total_count: 0, records: [] });
+ expect(sendRequest).not.toHaveBeenCalled();
+ });
});
describe('search_business_object_batch', () => {
diff --git a/packages/pieces/community/workday/test/api.test.ts b/packages/pieces/community/workday/test/api.test.ts
index 13b3841a3aa..8eb7e77b59b 100644
--- a/packages/pieces/community/workday/test/api.test.ts
+++ b/packages/pieces/community/workday/test/api.test.ts
@@ -5,6 +5,7 @@ import { AppConnectionType } from '@activepieces/pieces-framework';
import { workdayApi } from '../src/lib/common/api';
import { workdayClient } from '../src/lib/common/client';
+import { workdayUtils } from '../src/lib/common/utils';
const AUTH = {
type: AppConnectionType.OAUTH2,
@@ -476,3 +477,92 @@ describe('SOAP request bodies', () => {
expect(sendRequest).not.toHaveBeenCalled();
});
});
+
+describe('SOAP business object paging', () => {
+ function workersPage({ page, totalPages }: { page: number; totalPages: number }): string {
+ return `<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc"><env:Body><wd:Get_Workers_Response><wd:Response_Filter><wd:As_Of_Entry_DateTime>2026-10-02T00:00:00.000Z</wd:As_Of_Entry_DateTime></wd:Response_Filter><wd:Response_Results><wd:Total_Pages>${totalPages}</wd:Total_Pages><wd:Page>${page}</wd:Page></wd:Response_Results><wd:Response_Data><wd:Worker><wd:Worker_Reference><wd:ID wd:type="WID">w${page}</wd:ID></wd:Worker_Reference></wd:Worker></wd:Response_Data></wd:Get_Workers_Response></env:Body></env:Envelope>`;
+ }
+
+ it('fetches every page and reuses the first page as-of time', async () => {
+ sendRequest
+ .mockResolvedValueOnce(resp(workersPage({ page: 1, totalPages: 2 })))
+ .mockResolvedValueOnce(resp(workersPage({ page: 2, totalPages: 2 })));
+ const records = await workdayApi.listSoapObjects({
+ auth: ISU_AUTH,
+ object: workdayUtils.resolveSoapObject({ value: 'workers' }),
+ });
+ expect(records.map((record) => record['id'])).toEqual(['w1', 'w2']);
+ const second = String((sendRequest.mock.calls[1][0] as HttpRequest).body);
+ expect(second).toContain(
+ '<bsvc:As_Of_Entry_DateTime>2026-10-02T00:00:00.000Z</bsvc:As_Of_Entry_DateTime><bsvc:Page>2</bsvc:Page>',
+ );
+ expect((sendRequest.mock.calls[0][0] as HttpRequest).url).toBe(
+ 'https://wd2-impl-services1.workday.com/ccx/service/mytenant/Human_Resources/v47.0',
+ );
+ });
+
+ it('fetches every page when no limit is given, so triggers never drop changes', async () => {
+ sendRequest.mockImplementation(async (request: HttpRequest) => {
+ const page = Number(/<bsvc:Page>(\d+)<\/bsvc:Page>/.exec(String(request.body))?.[1] ?? 1);
+ return resp(workersPage({ page, totalPages: 51 }));
+ });
+ const records = await workdayApi.listSoapObjects({
+ auth: ISU_AUTH,
+ object: workdayUtils.resolveSoapObject({ value: 'workers' }),
+ });
+ expect(sendRequest).toHaveBeenCalledTimes(51);
+ expect(records.at(-1)?.['id']).toBe('w51');
+ });
+
+ it("ends the change window at Workday's own clock, not ours", async () => {
+ sendRequest
+ .mockResolvedValueOnce(
+ resp(
+ '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc"><env:Body><wd:Server_Timestamp><wd:Server_Timestamp_Data>2026-10-15T01:00:00.000-07:00</wd:Server_Timestamp_Data></wd:Server_Timestamp></env:Body></env:Envelope>',
+ ),
+ )
+ .mockResolvedValueOnce(resp(workersPage({ page: 1, totalPages: 1 })));
+ const result = await workdayApi.listChangedSoapObjects({
+ auth: ISU_AUTH,
+ object: workdayUtils.resolveSoapObject({ value: 'workers' }),
+ sinceEpochMS: Date.parse('2026-10-15T07:00:00.000Z'),
+ });
+ const body = String((sendRequest.mock.calls[1][0] as HttpRequest).body);
+ expect(body).toContain('<bsvc:Updated_From>2026-10-15T07:00:00.000Z</bsvc:Updated_From>');
+ expect(body).toContain('<bsvc:Updated_Through>2026-10-15T08:00:00.000Z</bsvc:Updated_Through>');
+ expect(result.updatedThroughEpochMS).toBe(Date.parse('2026-10-15T08:00:00.000Z'));
+ expect(result.records.map((record) => record['id'])).toEqual(['w1']);
+ });
+
+ it('only fetches payees by ID', async () => {
+ await expect(
+ workdayApi.listSoapObjects({
+ auth: ISU_AUTH,
+ object: workdayUtils.resolveSoapObject({ value: 'payees' }),
+ }),
+ ).rejects.toThrow('Payee can only be fetched by ID. Use Get Business Object Details.');
+ expect(sendRequest).not.toHaveBeenCalled();
+ });
+
+ it('refuses to watch objects without change tracking', async () => {
+ await expect(
+ workdayApi.listChangedSoapObjects({
+ auth: ISU_AUTH,
+ object: workdayUtils.resolveSoapObject({ value: 'locations' }),
+ sinceEpochMS: 0,
+ }),
+ ).rejects.toThrow("Workday does not track changes for Location, so it can't be watched.");
+ expect(sendRequest).not.toHaveBeenCalled();
+ });
+
+ it('uses a per-call WWS version when given', async () => {
+ sendRequest.mockResolvedValue(resp(SOAP_OK));
+ await workdayApi.callSoapOperation({
+ auth: ISU_AUTH,
+ service: 'Staffing',
+ operationXml: '<bsvc:Get_Positions_Request/>',
+ version: 'v45.0',
+ });
+ expect((sendRequest.mock.calls[0][0] as HttpRequest).url).toContain('/Staffing/v45.0');
+ });
+});
diff --git a/packages/pieces/community/workday/test/utils.test.ts b/packages/pieces/community/workday/test/utils.test.ts
index 2ea3f6b6335..8e4a82fe398 100644
--- a/packages/pieces/community/workday/test/utils.test.ts
+++ b/packages/pieces/community/workday/test/utils.test.ts
@@ -269,3 +269,95 @@ describe('toWorkdayModule', () => {
expect(() => workdayUtils.toWorkdayModule({ module: 'finance' })).toThrow();
});
});
+
+describe('SOAP business objects', () => {
+ const workers = workdayUtils.resolveSoapObject({ value: 'workers' });
+
+ it('builds a Get request with references, change window, paging and response group', () => {
+ const xml = workdayUtils.buildSoapGetRequest({
+ object: workers,
+ ids: ['3aa5550b7fe348b98d7b5741afc65534', '21<001'],
+ updatedFrom: '2026-10-01T00:00:00.000Z',
+ updatedThrough: '2026-10-02T00:00:00.000Z',
+ page: 2,
+ asOfEntryDateTime: '2026-10-02T00:00:00.000Z',
+ });
+ expect(xml).toContain('<bsvc:Get_Workers_Request xmlns:bsvc="urn:com.workday/bsvc">');
+ expect(xml).toContain(
+ '<bsvc:Worker_Reference><bsvc:ID bsvc:type="WID">3aa5550b7fe348b98d7b5741afc65534</bsvc:ID></bsvc:Worker_Reference>',
+ );
+ expect(xml).toContain('<bsvc:ID bsvc:type="Employee_ID">21&lt;001</bsvc:ID>');
+ expect(xml).toContain('<bsvc:Updated_From>2026-10-01T00:00:00.000Z</bsvc:Updated_From>');
+ expect(xml).toContain(
+ '<bsvc:Response_Filter><bsvc:As_Of_Entry_DateTime>2026-10-02T00:00:00.000Z</bsvc:As_Of_Entry_DateTime><bsvc:Page>2</bsvc:Page><bsvc:Count>100</bsvc:Count></bsvc:Response_Filter>',
+ );
+ expect(xml).toContain('<bsvc:Include_Reference>true</bsvc:Include_Reference>');
+ expect(xml.indexOf('Request_References')).toBeLessThan(xml.indexOf('Request_Criteria'));
+ expect(xml.indexOf('Request_Criteria')).toBeLessThan(xml.indexOf('Response_Filter'));
+ expect(xml.indexOf('Response_Filter')).toBeLessThan(xml.indexOf('Response_Group'));
+ });
+
+ it('puts payee references inside the request criteria', () => {
+ const xml = workdayUtils.buildSoapGetRequest({
+ object: workdayUtils.resolveSoapObject({ value: 'payees' }),
+ ids: ['21001'],
+ });
+ expect(xml).not.toContain('Request_References');
+ expect(xml).toContain(
+ '<bsvc:Request_Criteria><bsvc:Payee_Reference><bsvc:ID bsvc:type="Employee_ID">21001</bsvc:ID></bsvc:Payee_Reference></bsvc:Request_Criteria>',
+ );
+ });
+
+ it('reads records, paging info and simplifies references', () => {
+ const page = workdayUtils.readSoapGetPage({
+ object: workers,
+ body: {
+ Get_Workers_Response: {
+ Response_Filter: { As_Of_Entry_DateTime: '2026-10-02T00:00:00.000Z' },
+ Response_Results: { Total_Results: 101, Total_Pages: 2 },
+ Response_Data: {
+ Worker: {
+ Worker_Reference: {
+ ID: [
+ { '#text': 'abc', '@_type': 'WID' },
+ { '#text': 21001, '@_type': 'Employee_ID' },
+ ],
+ },
+ Worker_Descriptor: 'Logan McNeil',
+ Worker_Data: {
+ Location_Reference: {
+ '@_Descriptor': 'San Francisco',
+ ID: { '#text': 'loc', '@_type': 'WID' },
+ },
+ },
+ },
+ },
+ },
+ },
+ });
+ expect(page.totalPages).toBe(2);
+ expect(page.asOfEntryDateTime).toBe('2026-10-02T00:00:00.000Z');
+ expect(page.records).toEqual([
+ {
+ id: 'abc',
+ Worker_Reference: { WID: 'abc', Employee_ID: '21001' },
+ Worker_Descriptor: 'Logan McNeil',
+ Worker_Data: { Location_Reference: { WID: 'loc', descriptor: 'San Francisco' } },
+ },
+ ]);
+ });
+
+ it('lists only change-tracked objects for triggers', () => {
+ const tracked = workdayUtils
+ .soapObjects({ transactionLogOnly: true })
+ .map((item) => item.value);
+ expect(tracked).toEqual([
+ 'workers',
+ 'job_profiles',
+ 'positions',
+ 'job_requisitions',
+ 'evergreen_requisitions',
+ ]);
+ expect(() => workdayUtils.resolveSoapObject({ value: 'nope' })).toThrow();
+ });
+});