Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SMS recipient resolution in 'app_settings.json' #1770

Open
binokaryg opened this issue Feb 12, 2025 · 0 comments
Open

Improve SMS recipient resolution in 'app_settings.json' #1770

binokaryg opened this issue Feb 12, 2025 · 0 comments

Comments

@binokaryg
Copy link
Member

Page: /building/reference/app-settings/
Version: 2024-11-03 13:55:45 0100 0100

Under SMS recipient resolution, we have these two options among others:

value resolves to
ancestor:<contact_type> primary contact of the place of the requested type in the subject’s/submitter’s lineage
link:<contact_type> primary contact of the place of the requested contact_type in the subject’s/submitter’s lineage. As of 3.10.x

How do they differ? The descriptions look similar.

Looking at the code, it looks like the ancestor: looks for phone in the parent doc while link: first looks for a direct match, and if not found, goes to the parent:

  } else if (recipient.startsWith('ancestor:')) {
    const type = recipient.split(':')[1];
    phone = getParentPhone(context.patient, type) ||
            getParentPhone(context.place, type) ||
            getParentPhone(context, type);
  } else if (recipient.startsWith('link:')) {
    const tag = recipient.split(':')[1];
    phone = getLinkedPhone(context.patient, tag) ||
            getLinkedPhone(context.place, tag) ||
            getLinkedPhone(context.contact, tag) ||
            getParentPhone(context.patient, tag) ||
            getParentPhone(context.place, tag) ||
            getParentPhone(context.contact, tag);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant