Skip to content

Remap Upsert Pre/post Challeges #70

Open
@AishaHassen

Description

@AishaHassen

Background, context, and business value

Grassroot Soccer is rebuilding their integration, previously flowing from CommCare → Salesforce. The destination system is transitioning from a custom Salesforce data model to Amp Impact, which is a standardized data model built on Salesforce. The source system (CommCare) remains unchanged.

This update focuses on remapping existing workflows to align with the new Amp Impact data model, guided by updated mapping specifications. Much of the transformation logic in the previous implementation will be reused; however, Salesforce object and field targets will differ.

This issue relates specifically to the Upsert Pre Challeges and Upsert Post Challeges workflow, which needs to be rebuilt to match the updated mapping specification.

The specific request, in as few words as possible

Steps:

  • This workflow will first fetch ampi__Submission__c using the following query:
query(`
  SELECT Id, Name, RecordTypeId, ampi__Description__c, Type__c, Active__c, Curriculum__r.Name
  FROM ampi__Submission__c 
  WHERE Active__c = true 
  AND Type__c = 'Pre/Post Template' 
  AND Curriculum__r.Commcare_External_ID__c = ${state.data.form.hidden_properties.Curriculum}
`);
  • Next it will query an ampi__Project__c where Name = state.form.hidden_properties.intervention_name and save the returned object id as the event id

  • Next it will create an ampi__Submission__c as per the mapping spec

  • Next it will fetch the ampi__Question__c for the ampi__Submission__c created in the previous step

  • Next it will match the question.CommCare_External__ID__c to the CommCare questions such as a_mental_illness_is_a_sign_of_personal_weakness found in the form and update the ampi__Picklist_Response__c field for each question

  • New Data Model Reference: link

  • Mapping Specification: link

Data Volumes & Limits

Each webhook submission processes a single Upsert Pre Challeges \ Upsert Pre Challeges form with multiple questions for each form submission. There is no batching or volume constraints currently.

Workflow

This has been configured on a new workflow here for pre challange and here for post challenge, which can be edited to map to the new Salesforce data model.

Credentials

Salesforce: GRS SF Sandbox Integration User - May 25
CommCare: GRS CommCare App

Testing Guidance

  • Here is a test input
  • When an Upsert Pre/Post Challeges form is created on CommCare ensure that:
  1. One ampi__Submission__c has been upserted using externalId CommCare_External_ID
  2. Multiple ampi__Question__c for each question in form.pre_challeges_* has been updated with the correct response

Toggl

GRS Redesign 2025

Branch and project

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