SPMenu corrupts widgetParameters (regression in 4.10.0) #127
SPMenu corrupts widgetParameters (regression in 4.10.0)
Last good version: 4.9.2. Broken in 4.10.0, 4.10.1, 4.11.0. The build exits 0 with no warning. Installing the artifact overwrites the live Reproimport { SPMenu } from '@servicenow/sdk/core'
SPMenu({
$id: Now.ID['repro'],
title: 'repro',
widget: '5ef595c1cb12020000f8d856634c9c6e', // any sp_wid
column: '',
widgetParameters: {
enable_cart: { displayValue: 'false', value: false },
},
items: [],
})Run 4.9.2: {"enable_cart":{"displayValue":"false","value":false}}4.10.0, 4.10.1, 4.11.0: {"enable_cart":{"value":{"displayValue":"false","value":false},"displayValue":"[object Object]"}}ScopeOnly the Record({
table: 'sp_instance_menu' as any,
data: { widget_parameters: `{"enable_cart":{"displayValue },
})Our project contains both forms on the same table with identi FixTreat an entry that already has WorkaroundPin to 4.9.2, or define the record with EnvironmentmacOS 26.0, Node 22.22.3, pnpm 11.5.3. Scoped application, no |
Replies: 1 comment 1 reply
|
Hi @chasingtheflow — thanks for the detailed repro, this made it easy to track down. This is a regression introduced in the SPMenu widget-parameter serialization logic , shipped in 4.10.0. We will fix this in the next patch release Workaround until the fix ships: Pass widgetParameters as a pre-serialized JSON string instead of an object literal: SPMenu({
$id: Now.ID['my-menu'],
title: 'My Menu',
widget: '...',
widgetParameters: JSON.stringify({
enable_cart: { value: true, displayValue: 'true' },
enable_requests: { value: true, displayValue: 'true' },
enable_tasks: { value: true, displayValue: 'true' },
}),
}) |
Hi @chasingtheflow — thanks for the detailed repro, this made it easy to track down.
This is a regression introduced in the SPMenu widget-parameter serialization logic , shipped in 4.10.0. We will fix this in the next patch release
Workaround until the fix ships:
Pass widgetParameters as a pre-serialized JSON string instead of an object literal: