feat(commcare): user_fields list + set atoms#409
Merged
Conversation
…moved)
- commcare_list_user_fields: GETs /a/<domain>/users/user_data/, parses
the <div data-name="custom_fields" data-value="<json>"> initial_page_data
div (HQ's Django→JS bootstrap mechanism, per
corehq/apps/hqwebapp/templatetags/hq_shared_tags.py:650). Returns
the list of current fields + profiles. Surfaces the 302-to-settings
/users/ permission-redirect as a typed error.
- commcare_set_user_fields: POSTs the CustomDataFieldsForm to the
same URL with `data_fields` JSON-encoded. Direct form POST bypasses
the React/Knockout UI (verified against apps/custom_data_fields/
edit_model.py:491 — post() calls form.is_valid() then
save_custom_fields(), no UI involvement). DESTRUCTIVE: replaces
the existing list; callers should list_user_fields → merge → set.
V1 manual steps reduced from 3 to 2:
- DONE: UCR expressions (PR #397)
- DONE: custom user data field (this PR)
- STILL MANUAL: subscription provisioning (out-of-band, accounts@)
- STILL MANUAL: conditional alert (30+ field 3-form combined POST
with dynamic criteria + schedule choice tree; needs a known-working
reference to safely construct field combos. Defer until we have
access to one of the team's existing alerts to model against.)
Conditional alert API hunt confirmed via codebase:
- corehq/messaging/scheduling/urls.py — only admin views (list/create/
edit/download/upload). No Tastypie, no DRF.
- The download/upload variants are XLS, not CSV (Format.XLS_2007).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds list + set for custom user data fields.
V1 manual steps: 3 → 2 (only subscription + conditional alert remain). Conditional alert atom requires a known-working reference alert to safely construct the 30+ field 3-form POST; deferred until we can access the team's existing alerts.
🤖 Generated with Claude Code