Update readonly fields (e.g. ClosedBy, ResolvedBy)
Some fields (e.g. ResolvedBy, ClosedBy) are read-only under normal rules. To update them you must set BypassRules='true' in the WITH clause. Use this only when you need to set system or audit fields; suppress notifications or validate-only options are also available in WITH for testing or reducing email noise.
UPDATE WorkItems
SET [Title] = 'Update-QA Task <<FUN_NOW>>'
, [Description] = 'Updated desc <<FUN_NOW>>'
, [WorkItemType]='Bug' -- Task
, [State] = 'Resolved'
, [Tags] = 'odata; api'
, [ResolvedBy] = 'some.one@mycompany.com' --(Must set ByPassRules='true' Param to set this readonly field)
WHERE [Id] = 9626
WITH(
BypassRules='true' --Useful to Update ReadOnly Fields like ResolvedBy, ClosedBy
-- ,SuppressNotifications='true' --Avoids email notifications on change
-- ,ValidateOnly='true' --Dont perform actual update - just validate
)