Skip to content

Commit 4a2b8b8

Browse files
committed
checkpoint workday block
1 parent 5332614 commit 4a2b8b8

File tree

17 files changed

+2000
-0
lines changed

17 files changed

+2000
-0
lines changed

apps/sim/blocks/blocks/workday.ts

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.

apps/sim/blocks/registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ import { WebhookRequestBlock } from '@/blocks/blocks/webhook_request'
188188
import { WhatsAppBlock } from '@/blocks/blocks/whatsapp'
189189
import { WikipediaBlock } from '@/blocks/blocks/wikipedia'
190190
import { WordPressBlock } from '@/blocks/blocks/wordpress'
191+
import { WorkdayBlock } from '@/blocks/blocks/workday'
191192
import { WorkflowBlock } from '@/blocks/blocks/workflow'
192193
import { WorkflowInputBlock } from '@/blocks/blocks/workflow_input'
193194
import { XBlock } from '@/blocks/blocks/x'
@@ -408,6 +409,7 @@ export const registry: Record<string, BlockConfig> = {
408409
whatsapp: WhatsAppBlock,
409410
wikipedia: WikipediaBlock,
410411
wordpress: WordPressBlock,
412+
workday: WorkdayBlock,
411413
workflow: WorkflowBlock,
412414
workflow_input: WorkflowInputBlock,
413415
x: XBlock,

apps/sim/components/icons.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ export function NoteIcon(props: SVGProps<SVGSVGElement>) {
124124
)
125125
}
126126

127+
export function WorkdayIcon(props: SVGProps<SVGSVGElement>) {
128+
return (
129+
<svg {...props} viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'>
130+
<circle cx='16' cy='8' r='4' fill='#F68D2E' />
131+
<ellipse cx='16' cy='22' rx='10' ry='6' fill='#0875E1' />
132+
</svg>
133+
)
134+
}
135+
127136
export function WorkflowIcon(props: SVGProps<SVGSVGElement>) {
128137
return (
129138
<svg

apps/sim/tools/registry.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,18 @@ import {
22552255
wordpressUpdatePostTool,
22562256
wordpressUploadMediaTool,
22572257
} from '@/tools/wordpress'
2258+
import {
2259+
workdayAssignOnboardingTool,
2260+
workdayChangeJobTool,
2261+
workdayCreatePrehireTool,
2262+
workdayGetCompensationTool,
2263+
workdayGetOrganizationsTool,
2264+
workdayGetWorkerTool,
2265+
workdayHireEmployeeTool,
2266+
workdayListWorkersTool,
2267+
workdayTerminateWorkerTool,
2268+
workdayUpdateWorkerTool,
2269+
} from '@/tools/workday'
22582270
import { workflowExecutorTool } from '@/tools/workflow'
22592271
import {
22602272
xCreateBookmarkTool,
@@ -4072,6 +4084,16 @@ export const tools: Record<string, ToolConfig> = {
40724084
wordpress_list_users: wordpressListUsersTool,
40734085
wordpress_get_user: wordpressGetUserTool,
40744086
wordpress_search_content: wordpressSearchContentTool,
4087+
workday_get_worker: workdayGetWorkerTool,
4088+
workday_list_workers: workdayListWorkersTool,
4089+
workday_create_prehire: workdayCreatePrehireTool,
4090+
workday_hire_employee: workdayHireEmployeeTool,
4091+
workday_update_worker: workdayUpdateWorkerTool,
4092+
workday_assign_onboarding: workdayAssignOnboardingTool,
4093+
workday_get_organizations: workdayGetOrganizationsTool,
4094+
workday_change_job: workdayChangeJobTool,
4095+
workday_get_compensation: workdayGetCompensationTool,
4096+
workday_terminate_worker: workdayTerminateWorkerTool,
40754097
google_ads_list_customers: googleAdsListCustomersTool,
40764098
google_ads_search: googleAdsSearchTool,
40774099
google_ads_list_campaigns: googleAdsListCampaignsTool,
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import { createLogger } from '@sim/logger'
2+
import type { ToolConfig } from '@/tools/types'
3+
import type {
4+
WorkdayAssignOnboardingParams,
5+
WorkdayAssignOnboardingResponse,
6+
} from '@/tools/workday/types'
7+
import { buildWorkdayBaseUrl, createWorkdayAuthHeader } from '@/tools/workday/utils'
8+
9+
const logger = createLogger('WorkdayAssignOnboardingTool')
10+
11+
export const assignOnboardingTool: ToolConfig<
12+
WorkdayAssignOnboardingParams,
13+
WorkdayAssignOnboardingResponse
14+
> = {
15+
id: 'workday_assign_onboarding',
16+
name: 'Assign Workday Onboarding Plan',
17+
description:
18+
'Create or update an onboarding plan assignment for a worker. Sets up onboarding stages and manages the assignment lifecycle.',
19+
version: '1.0.0',
20+
21+
params: {
22+
tenantUrl: {
23+
type: 'string',
24+
required: true,
25+
visibility: 'user-only',
26+
description: 'Workday instance URL (e.g., https://wd5-impl-services1.workday.com)',
27+
},
28+
tenant: {
29+
type: 'string',
30+
required: true,
31+
visibility: 'user-only',
32+
description: 'Workday tenant name',
33+
},
34+
username: {
35+
type: 'string',
36+
required: true,
37+
visibility: 'user-only',
38+
description: 'Integration System User username',
39+
},
40+
password: {
41+
type: 'string',
42+
required: true,
43+
visibility: 'user-only',
44+
description: 'Integration System User password',
45+
},
46+
workerId: {
47+
type: 'string',
48+
required: true,
49+
visibility: 'user-or-llm',
50+
description: 'Worker ID to assign the onboarding plan to',
51+
},
52+
onboardingPlanId: {
53+
type: 'string',
54+
required: true,
55+
visibility: 'user-or-llm',
56+
description: 'Onboarding plan ID to assign',
57+
},
58+
stages: {
59+
type: 'string',
60+
required: false,
61+
visibility: 'user-or-llm',
62+
description:
63+
'JSON array of onboarding stage IDs to include (optional, defaults to all stages)',
64+
},
65+
},
66+
67+
request: {
68+
url: (params) => {
69+
const baseUrl = buildWorkdayBaseUrl(params.tenantUrl, params.tenant)
70+
return `${baseUrl}/workers/${params.workerId}/onboardingPlanAssignments`
71+
},
72+
method: 'POST',
73+
headers: (params) => ({
74+
Authorization: createWorkdayAuthHeader(params.username, params.password),
75+
'Content-Type': 'application/json',
76+
Accept: 'application/json',
77+
}),
78+
body: (params) => {
79+
const body: Record<string, unknown> = {
80+
onboardingPlan: { id: params.onboardingPlanId },
81+
}
82+
83+
if (params.stages) {
84+
try {
85+
const parsedStages =
86+
typeof params.stages === 'string' ? JSON.parse(params.stages) : params.stages
87+
body.stages = Array.isArray(parsedStages)
88+
? parsedStages.map((s: string) => ({ id: s }))
89+
: []
90+
} catch {
91+
body.stages = []
92+
}
93+
}
94+
95+
return body
96+
},
97+
},
98+
99+
transformResponse: async (response: Response) => {
100+
try {
101+
const data = await response.json()
102+
103+
if (!response.ok) {
104+
const error = data.error ?? data.errors?.[0]?.error ?? data
105+
throw new Error(typeof error === 'string' ? error : JSON.stringify(error))
106+
}
107+
108+
return {
109+
success: true,
110+
output: {
111+
assignmentId: data.id ?? null,
112+
workerId: data.worker?.id ?? null,
113+
planId: data.onboardingPlan?.id ?? null,
114+
},
115+
}
116+
} catch (error) {
117+
logger.error('Workday assign onboarding - Error processing response:', { error })
118+
throw error
119+
}
120+
},
121+
122+
outputs: {
123+
assignmentId: {
124+
type: 'string',
125+
description: 'Onboarding plan assignment ID',
126+
},
127+
workerId: {
128+
type: 'string',
129+
description: 'Worker ID the plan was assigned to',
130+
},
131+
planId: {
132+
type: 'string',
133+
description: 'Onboarding plan ID that was assigned',
134+
},
135+
},
136+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import { createLogger } from '@sim/logger'
2+
import type { ToolConfig } from '@/tools/types'
3+
import type { WorkdayChangeJobParams, WorkdayChangeJobResponse } from '@/tools/workday/types'
4+
import { buildWorkdayBaseUrl, createWorkdayAuthHeader } from '@/tools/workday/utils'
5+
6+
const logger = createLogger('WorkdayChangeJobTool')
7+
8+
export const changeJobTool: ToolConfig<WorkdayChangeJobParams, WorkdayChangeJobResponse> = {
9+
id: 'workday_change_job',
10+
name: 'Change Workday Job',
11+
description:
12+
'Perform a job change for a worker including transfers, promotions, demotions, and lateral moves.',
13+
version: '1.0.0',
14+
15+
params: {
16+
tenantUrl: {
17+
type: 'string',
18+
required: true,
19+
visibility: 'user-only',
20+
description: 'Workday instance URL (e.g., https://wd5-impl-services1.workday.com)',
21+
},
22+
tenant: {
23+
type: 'string',
24+
required: true,
25+
visibility: 'user-only',
26+
description: 'Workday tenant name',
27+
},
28+
username: {
29+
type: 'string',
30+
required: true,
31+
visibility: 'user-only',
32+
description: 'Integration System User username',
33+
},
34+
password: {
35+
type: 'string',
36+
required: true,
37+
visibility: 'user-only',
38+
description: 'Integration System User password',
39+
},
40+
workerId: {
41+
type: 'string',
42+
required: true,
43+
visibility: 'user-or-llm',
44+
description: 'Worker ID for the job change',
45+
},
46+
effectiveDate: {
47+
type: 'string',
48+
required: true,
49+
visibility: 'user-or-llm',
50+
description: 'Effective date for the job change in ISO 8601 format (e.g., 2025-06-01)',
51+
},
52+
newPositionId: {
53+
type: 'string',
54+
required: false,
55+
visibility: 'user-or-llm',
56+
description: 'New position ID (for transfers)',
57+
},
58+
newJobProfileId: {
59+
type: 'string',
60+
required: false,
61+
visibility: 'user-or-llm',
62+
description: 'New job profile ID (for role changes)',
63+
},
64+
newLocationId: {
65+
type: 'string',
66+
required: false,
67+
visibility: 'user-or-llm',
68+
description: 'New work location ID (for relocations)',
69+
},
70+
newManagerId: {
71+
type: 'string',
72+
required: false,
73+
visibility: 'user-or-llm',
74+
description: 'New manager worker ID (for reporting changes)',
75+
},
76+
reason: {
77+
type: 'string',
78+
required: false,
79+
visibility: 'user-or-llm',
80+
description: 'Reason for the job change (e.g., Promotion, Transfer, Reorganization)',
81+
},
82+
},
83+
84+
request: {
85+
url: (params) => {
86+
const baseUrl = buildWorkdayBaseUrl(params.tenantUrl, params.tenant)
87+
return `${baseUrl}/workers/${params.workerId}/jobChanges`
88+
},
89+
method: 'POST',
90+
headers: (params) => ({
91+
Authorization: createWorkdayAuthHeader(params.username, params.password),
92+
'Content-Type': 'application/json',
93+
Accept: 'application/json',
94+
}),
95+
body: (params) => {
96+
const body: Record<string, unknown> = {
97+
effectiveDate: params.effectiveDate,
98+
}
99+
100+
if (params.newPositionId) body.position = { id: params.newPositionId }
101+
if (params.newJobProfileId) body.jobProfile = { id: params.newJobProfileId }
102+
if (params.newLocationId) body.location = { id: params.newLocationId }
103+
if (params.newManagerId) body.manager = { id: params.newManagerId }
104+
if (params.reason) body.reason = params.reason
105+
106+
return body
107+
},
108+
},
109+
110+
transformResponse: async (response: Response) => {
111+
try {
112+
const data = await response.json()
113+
114+
if (!response.ok) {
115+
const error = data.error ?? data.errors?.[0]?.error ?? data
116+
throw new Error(typeof error === 'string' ? error : JSON.stringify(error))
117+
}
118+
119+
return {
120+
success: true,
121+
output: {
122+
eventId: data.id ?? null,
123+
workerId: data.worker?.id ?? null,
124+
effectiveDate: data.effectiveDate ?? null,
125+
},
126+
}
127+
} catch (error) {
128+
logger.error('Workday change job - Error processing response:', { error })
129+
throw error
130+
}
131+
},
132+
133+
outputs: {
134+
eventId: {
135+
type: 'string',
136+
description: 'Job change event ID',
137+
},
138+
workerId: {
139+
type: 'string',
140+
description: 'Worker ID the job change was applied to',
141+
},
142+
effectiveDate: {
143+
type: 'string',
144+
description: 'Effective date of the job change',
145+
},
146+
},
147+
}

0 commit comments

Comments
 (0)