Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions apps/docs/content/docs/integrations/okta.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,28 @@ Unsuspend a previously suspended user in your Okta organization. Returns the use

</ReferenceDetails>

### Unlock User in Okta

Unlock a LOCKED_OUT user, or an ACTIVE user blocked from unknown devices, so they can sign in with their current password. Works only for Okta-sourced users, not directory-sourced accounts such as Active Directory.

<ReferenceDetails>

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `userId` | string | Yes | User ID or login to unlock |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `userId` | string | Unlocked user ID |
| `unlocked` | boolean | Whether the user was unlocked |
| `success` | boolean | Operation success status |

</ReferenceDetails>

### Reset Password in Okta

Generate a one-time token to reset a user password. Can email the reset link to the user or return it directly. Transitions the user to RECOVERY status.
Expand Down Expand Up @@ -542,6 +564,39 @@ List all members of a specific group in your Okta organization

</ReferenceDetails>

### List User Groups from Okta

List the groups a user is a member of, one page at a time (pass nextCursor back as after while hasMore is true). Use it for access reviews and offboarding instead of scanning the members of each group.

<ReferenceDetails>

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `userId` | string | Yes | User ID or login whose groups to list |
| `after` | string | No | Opaque pagination cursor returned as nextCursor by a previous call |
| `limit` | number | No | Maximum number of groups to return per page \(Okta default: 200\) |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `groups` | array | Array of groups the user belongs to |
| ↳ `id` | string | Group ID |
| ↳ `name` | string | Group name |
| ↳ `description` | string | Group description |
| ↳ `type` | string | Group type \(OKTA_GROUP, APP_GROUP, BUILT_IN\) |
| ↳ `created` | string | Creation timestamp |
| ↳ `lastUpdated` | string | Last update timestamp |
| ↳ `lastMembershipUpdated` | string | Last membership change timestamp |
| `count` | number | Number of groups returned |
| `nextCursor` | string | Cursor for the next page, or null on the last page |
| `hasMore` | boolean | Whether more groups are available |
| `success` | boolean | Operation success status |

</ReferenceDetails>

### List Group Rules from Okta

List the group rules in your Okta organization. Each rule assigns users to groups automatically based on an expression over their profile, so this shows how group membership is being driven.
Expand Down
161 changes: 117 additions & 44 deletions apps/docs/content/docs/integrations/rippling.mdx

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions apps/docs/content/docs/integrations/snowflake.mdx

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/docs/content/docs/integrations/zoho_desk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Update fields on an existing Zoho Desk ticket.
| `language` | string | No | Ticket language |
| `channel` | string | No | Ticket origin channel |
| `webUrl` | string | No | URL to access the ticket |
| `sharedDepartments` | array | No | JSON array of shared departments and access privileges |
| `sharedDepartments` | array | No | Departments to share the ticket with, each as \{"id": departmentId, "type": "READ_ONLY" \| "READ_WRITE" \| "RESTRICTED_ACCESS"\}. JSON array. |
| `teamId` | string | No | Team ID |
| `secondaryContacts` | array | No | JSON array of secondary contact IDs |
| `entitySkills` | array | No | JSON array of skill IDs in priority order; at most 10 |
Expand Down Expand Up @@ -353,7 +353,7 @@ Add a comment to a Zoho Desk ticket.

### Zoho Desk List Threads

List conversation threads on a Zoho Desk ticket, newest first (Zoho sorts by sendDateTime descending by default). Returns a list projection: message bodies (content, summary, to/cc/bcc) come back only from Get Thread.
List conversation threads on a Zoho Desk ticket, newest first (Zoho sorts by sendDateTime descending by default). Returns a list projection: message bodies (content) come back only from Get Thread.

<ReferenceDetails>

Expand Down Expand Up @@ -588,7 +588,7 @@ Create Ticket in Zoho Desk.
| `uploads` | array | No | File attachments in the ticket. For more information, refer to the Uploads section JSON array. |
| `resolution` | string | No | Resolution notes of the ticket |
| `webUrl` | string | No | URL to access the resource |
| `sharedDepartments` | array | No | List of departments to which the ticket could be shared, along with the access privileges for each department JSON array. |
| `sharedDepartments` | array | No | Departments to share the ticket with, each as \{"id": departmentId, "type": "READ_ONLY" \| "READ_WRITE" \| "RESTRICTED_ACCESS"\}. JSON array. |
| `teamId` | string | No | ID of the team to assign the ticket |
| `secondaryContacts` | array | No | List of Secondary contacts JSON array. |
| `entitySkills` | array | No | JSON array of up to 10 skill IDs, ordered from highest to lowest assignment priority. |
Expand Down
166 changes: 165 additions & 1 deletion apps/sim/blocks/blocks/microsoft_dynamics_365.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { describe, expect, it } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { MicrosoftDynamics365Block } from '@/blocks/blocks/microsoft_dynamics_365'
import { getToolMetadata } from '@/tools/metadata'
import { microsoftDynamics365ListRecordsTool } from '@/tools/microsoft_dynamics_365/list_records'
import { microsoftDynamics365UpdateRecordTool } from '@/tools/microsoft_dynamics_365/update_record'
import { getSubBlocksForToolInput } from '@/tools/params'

const BASE_PARAMS = {
credential: 'credential-1',
Expand Down Expand Up @@ -330,6 +334,16 @@ describe('MicrosoftDynamics365Block', () => {
).toThrow('Time spent must be at most 2147483647')
})

it('refuses to close an opportunity whose canvas Outcome is blank instead of assuming won', () => {
expect(() =>
mapParams({
operation: 'close_opportunity',
closeOpportunityId: '11111111-1111-4111-8111-111111111111',
opportunityOutcome: '',
})
).toThrow('Outcome')
})

it('supports an optional opportunity subject and enforces close-description limits', () => {
expect(
mapParams({
Expand Down Expand Up @@ -378,3 +392,153 @@ describe('MicrosoftDynamics365Block', () => {
).toBeUndefined()
})
})

/**
* Agent tool rows, Pi, and Human v2 pass the operation only in the mapper context. Params hold the
* stored row values merged with the model's args, which are keyed by the selected tool's param
* names. A tool row stores only fields tool-input renders, so block-only dropdowns such as
* `recordType` and `ownerType` are absent.
*/
describe('MicrosoftDynamics365Block tool-call mapping', () => {
const RECORD_ID = '11111111-1111-4111-8111-111111111111'
const OWNER_ID = 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa'

function mapToolCall(operation: string, params: Record<string, unknown>) {
const mapper = MicrosoftDynamics365Block.tools.config?.params
if (!mapper) throw new Error('Dynamics 365 CRM block is missing its params mapper')
return mapper({ ...BASE_PARAMS, ...params }, { operation })
}

it('renders Owner Type and Owner ID on the List Owners and Assign Record tool rows', () => {
const rowTools = [microsoftDynamics365ListRecordsTool, microsoftDynamics365UpdateRecordTool]
vi.mocked(getToolMetadata).mockImplementationOnce(lookup).mockImplementationOnce(lookup)
function lookup(toolId: string) {
const tool = rowTools.find((candidate) => candidate.id === toolId)
return tool && { id: tool.id, params: tool.params }
}
const rowFields = (toolId: string, operation: string) =>
getSubBlocksForToolInput(
toolId,
'microsoft_dynamics_365',
{ operation },
{},
MicrosoftDynamics365Block
)?.subBlocks.map((subBlock) => subBlock.id)

expect(rowFields('microsoft_dynamics_365_list_records', 'list_owners')).toContain('ownerType')
expect(rowFields('microsoft_dynamics_365_update_record', 'assign_record')).toEqual(
expect.arrayContaining(['ownerType', 'ownerId'])
)
})

it('lists owners from the row-stored owner type on a tool call', () => {
expect(
mapToolCall('list_owners', { ownerType: 'team', entitySetName: 'accounts' })
).toMatchObject({ entitySetName: 'teams' })
})

it('assigns the record the model names to the row-stored owner on a tool call', () => {
expect(
mapToolCall('assign_record', {
ownerType: 'team',
ownerId: OWNER_ID,
entitySetName: 'contacts',
recordId: RECORD_ID,
})
).toEqual({
...BASE_PARAMS,
entitySetName: 'contacts',
recordId: RECORD_ID,
data: { 'ownerid@odata.bind': `/teams(${OWNER_ID})` },
})
})

it('applies the stored resolution subject when the model sends only the case ID', () => {
expect(
mapToolCall('close_case', { caseSubject: 'Resolved by agent', caseId: RECORD_ID })
).toEqual({ ...BASE_PARAMS, caseId: RECORD_ID, subject: 'Resolved by agent' })
expect(
mapToolCall('close_case', { caseId: RECORD_ID, subject: 'Model subject', timeSpent: 15 })
).toEqual({ ...BASE_PARAMS, caseId: RECORD_ID, subject: 'Model subject', timeSpent: 15 })
})

it('keeps typed model list args over the stored count switch', () => {
expect(
mapToolCall('list_records', {
includeCount: false,
entitySetName: 'contacts',
select: 'fullname',
pageSize: 10,
count: true,
})
).toEqual({
...BASE_PARAMS,
entitySetName: 'contacts',
select: 'fullname',
pageSize: 10,
count: 'true',
})
})

it('closes the opportunity the model names with the outcome it chose', () => {
expect(
mapToolCall('close_opportunity', {
opportunityId: RECORD_ID,
outcome: 'lost',
statusReason: 4,
})
).toEqual({ ...BASE_PARAMS, opportunityId: RECORD_ID, outcome: 'lost', statusReason: 4 })
})

it('refuses to close an opportunity when the model omits the outcome', () => {
expect(() => mapToolCall('close_opportunity', { opportunityId: RECORD_ID })).toThrow(
'Outcome is required'
)
})

it('searches the model entities and numeric paging, else every CRM table', () => {
const entityList = [{ name: 'contact' }, { name: 'lead' }]
const entities = JSON.stringify(entityList)
expect(
mapToolCall('search_records', { searchTerm: 'Contoso', entities, top: 10, skip: 20 })
).toMatchObject({ entities, top: 10, skip: 20, searchMode: 'any', searchType: 'simple' })
expect(
mapToolCall('search_records', { searchTerm: 'Contoso', entities: entityList })
).toMatchObject({ entities })
const omitted = mapToolCall('search_records', { searchTerm: 'Contoso' })
expect(omitted).toMatchObject({ searchTerm: 'Contoso', top: 100 })
expect(omitted).not.toHaveProperty('entities')
})

it('leaves qualification switches the model omits for the tool to reject', () => {
const mapped = mapToolCall('qualify_lead', { leadId: RECORD_ID })
expect(mapped).toEqual({ ...BASE_PARAMS, leadId: RECORD_ID })
expect(mapped).not.toHaveProperty('createAccount')
expect(mapped).not.toHaveProperty('createContact')
expect(mapped).not.toHaveProperty('createOpportunity')
})

it('passes model qualification references when no stored values exist', () => {
expect(
mapToolCall('qualify_lead', {
leadId: RECORD_ID,
createAccount: false,
createContact: false,
createOpportunity: true,
statusReason: 3,
opportunityCustomerId: OWNER_ID,
opportunityCustomerType: 'contact',
qualifyOpportunityCustomerType: 'account',
})
).toEqual({
...BASE_PARAMS,
leadId: RECORD_ID,
createAccount: false,
createContact: false,
createOpportunity: true,
statusReason: 3,
opportunityCustomerId: OWNER_ID,
opportunityCustomerType: 'contact',
})
})
})
Loading
Loading