Skip to content

Commit 65b8e8e

Browse files
waleedlatif1claude
andcommitted
fix(microsoft-ad): prevent visibility from always being sent on group update
Split visibility dropdown into separate create/update subBlocks with "No Change" default for update_group, preventing silent overwrite of group visibility when updating other fields like description. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1d93479 commit 65b8e8e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

apps/sim/blocks/blocks/microsoft_ad.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,25 @@ export const MicrosoftAdBlock: BlockConfig<MicrosoftAdResponse> = {
279279
id: 'visibility',
280280
title: 'Visibility',
281281
type: 'dropdown',
282+
options: [
283+
{ label: 'No Change', id: '' },
284+
{ label: 'Private', id: 'Private' },
285+
{ label: 'Public', id: 'Public' },
286+
],
287+
value: () => '',
288+
condition: { field: 'operation', value: 'update_group' },
289+
mode: 'advanced',
290+
},
291+
{
292+
id: 'visibilityCreate',
293+
title: 'Visibility',
294+
type: 'dropdown',
282295
options: [
283296
{ label: 'Private', id: 'Private' },
284297
{ label: 'Public', id: 'Public' },
285298
],
286299
value: () => 'Private',
287-
condition: { field: 'operation', value: ['create_group', 'update_group'] },
300+
condition: { field: 'operation', value: 'create_group' },
288301
mode: 'advanced',
289302
},
290303
// Member ID (for add/remove member)
@@ -330,7 +343,8 @@ export const MicrosoftAdBlock: BlockConfig<MicrosoftAdResponse> = {
330343
if (params.groupMailNickname) result.mailNickname = params.groupMailNickname
331344
if (params.groupDescription) result.description = params.groupDescription
332345
if (params.groupTypes !== undefined) result.groupTypes = params.groupTypes
333-
if (params.visibility) result.visibility = params.visibility
346+
const visibilityVal = params.visibility || params.visibilityCreate
347+
if (visibilityVal) result.visibility = visibilityVal
334348
return result
335349
},
336350
},
@@ -361,6 +375,7 @@ export const MicrosoftAdBlock: BlockConfig<MicrosoftAdResponse> = {
361375
securityEnabled: { type: 'string' },
362376
groupTypes: { type: 'string' },
363377
visibility: { type: 'string' },
378+
visibilityCreate: { type: 'string' },
364379
memberId: { type: 'string' },
365380
},
366381
outputs: {

0 commit comments

Comments
 (0)