Skip to content

Remap Upsert Attendance Skillz Plus Club #69

Open
@AishaHassen

Description

@AishaHassen

Background, context, and business value

Grassroot Soccer uses CommCare to track attendance of participants in recurring coach-led events. These attendance records must be synced to AMP Impact (Salesforce), where each attendance links a participant (Contact), their registration (Event Participation), and a specific session (Event Session) under a larger Event. This structure allows GRS to track who attended which session of which event and when.

The specific request, in as few words as possible

Update the existing OpenFn job to receive CommCare form submissions via webhook and:

  • Upsert Event Participation records (AMP Impact object: Event_Participation__c)
  • Identify the next blank Event Session for the Event and set its Date__c (do not update Duration)
  • Upsert an Attendance record per participant linked to:
    • the relevant Event Participation
    • the newly updated Event Session

Links

Data Volumes & Limits

Each CommCare form submission may contain 1 or more participants. For each participant, one Event Participation (if not already present) and one Attendance record should be upserted. All participants in a single submission should be linked to the same Event Session.

Upsert Upsert Attendance Skillz Plus Club Workflow

Image

Trigger: Webhook Trigger

  • Triggered when a new CommCare form is submitted

Step: Upsert Attendance Skillz Plus Club

  • Adaptor: Salesforce
  • Edge: state.data.form["business_unit"] != "57ac433fe0cb4319a701cc9e7c721816" && state.data.form["skillz_attendance"] == "1"
  • Input: Sample Data
  • Credential: LP GRS SF Sandbox Admin User - May 25
  • Desired Output: The job should loop through each participant in form.attendance_list.update_participant_cases.item[]:
    • Identify and Update Event Session
      • This is done once per submission, before looping through participants
      • Fetch the first Event_Session__c where:
        • Event__r.CommCare_External_ID__c = form.case["@case_id"]
        • Date__c IS NULL
      • Sort: CreatedDate ASC
      • Update: Date__c = item.date (use date from first participant item)
    • Loop through each participant in form.attendance_list.update_participant_cases.item[]:
      • For each participant, perform the following actions:
        • Upsert Event Participation
          • Use External ID: CommCare_External_ID__c = [event_case_id + "_" + participant_id]
          • Relationships:
            • Contact__r.CommCare_External_ID__c = item["@id"]
            • Event__r.CommCare_External_ID__c = form.case["@case_id"]
        • Upsert Attendance
          • Use External ID: [EventParticipationID]_[EventSessionID]
          • Relationships:
            • Event_Participation__r.CommCare_External_ID__c
            • Event_Session__r.Id (from earlier step)
            • Map Attended__c based on attendance_session:
              • "yes""Attended"
              • "no""Not Attended"
              • "" (empty) → null

Testing Guidance

  • Submit test forms with 1 and multiple participants
  • Ensure that:
    • All participants are linked to the same updated Event Session
    • Only one Event Session is updated per submission
    • Attendance is not duplicated on reprocessing
    • Attended__c values map correctly
  • Test when:
    • Participant already has Event Participation
    • Event Participation needs to be created

Toggl

GRS Redesign 2025

Pre-Development Checklist

Before handling this issue to a developer, ensure the following items are
checked:

  • Credentials: Ensure all necessary credentials are available and
    documented.
  • Sample Input Data: Ensure sample input data is provided and linked.
  • PII: Verify if any Personally Identifiable Information (PII) is involved
    and ensure proper handling.
  • Collections: Confirm if collections are needed and pre-configure with
    sample data if required.
  • Mapping Spec: Ensure mapping specifications are complete and linked.
  • API Docs: Ensure all relevant API documentation is linked.
  • Workflow Diagrams: Ensure workflow diagrams are complete and linked.
  • VPN Access: Ensure VPN Access is provided if required to run the workflow
  • Toggl: Ensure the Toggl project name is provided.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions