Is there a way to setup a Subscription to only tri...
# general
m
Is there a way to setup a Subscription to only trigger when a given resourceType is created? Looking the logic for
Subscription.criteria
, I would say no because it just checks the resourceType. Also in a bot example it has this check: https://github.com/medplum/medplum-demo-bots/blob/main/src/examples/sample-account-setup.ts#L23-L28 It would be great to have this functionality so that a lambda isn't triggered every time a resource is updated when the bot only cares about it on creation. Update: I found in an older message that the answer is no due to the fhir spec: https://www.hl7.org/fhir/subscription.html Please let me know if there have been any changes since.
r
Unfortunately, we follow the FHIR specification on Subscription semantics, which dicates firing on every update: https://hl7.org/fhir/r4/subscription.html
m
Thanks. Just saw your message from a while ago while searching.
r
Internally, we have considered maybe adding some kind of medplum-specific extension to the Subscription, to help handle this use case, as it does come up a lot
m
It would be ideal for us because as we scale, we will not want to pay for those extra lambda triggers that do not do anything.
178 Views