Value required at path: /statusReason for Task upd...
# support
n
I'm running into an error when attempting to patch a `Task`'s
statusReason
field using a
CodeableConcept
.
Copy code
Value required at path: /statusReason
traceId=d9bd719e-ec37-4703-bffc-9048b8745d2f
I'm also noticing that the Medplum app UI does not support editing the
Task.statusReason
field as it appears to be entirely ignored.
cc @rahul1 as this is a blocker we could just leverage an extension for capturing status reason but that seems much less appropriate for more context, this is effectively the patch that is being executed
Copy code
ts
      const statusReasonValue: CodeableConcept = {
        coding: [
          {
            system: System.CarePathwayAdjustmentStatusReason,
          },
        ],
        text: actionReason,
      };
      return medplum.patchResource('Task', task.id!, [
        { op: 'replace', path: '/status', value: actionIntent === 'approve' ? 'accepted' : 'rejected' },
        { op: 'replace', path: '/statusReason', value: statusReasonValue },
      ]);
r
Hi @node5585 - For PATCH,
replace
will only work if there is an existing value at that path. You will have to use
add
to insert a new value
Unfortunately, JSONPatch doesn't provide a built-in
upsert
operation
WRT the to the UI bug, we are investigating
n

https://tenor.com/tNzuJFsBWQm.gif

r
133 Views