Skip to content

Example Queries

Summary of organisation engagements

This query will return a list of organisations, and details about the engagements for those organisations. One interesting thing to note here: if your token lacks the "engagements" permission then this will still return details about your engagements, but some fields will be redacted based on the sensitivity of the engagement.

query Engagements {
  organisations {
    engagements {
      standardObjective { name }
      beginDate
      endDate
      organisation { name }
      organisationRole
      status
      community {
        name
        language { name }
      }
      sensitivity
      internalNote
      sharedNote

      # last update by a "user"
      lastUserUpdated
      # last update by anything, including an import/automation
      lastUpdated
    }
  }
}
Outcome assessments

This query will return a list of projects and their outcomes. Each outcome will be returned with its communities (taken from its goals).

query OutcomeProgressStatus {
  projects {
    name
    outcomes {
      name
      communities { id name }
      progressAssessments {
        month
        status
        community { id name }
      }
    }
  }
}
Goal status

This query will return a list of projects and their goals. Each goal will include a progress schema representing work in a particular community (or null for project-level goals). Each progress schema will contain a list of monthly "status" records.

query ProgressSchemaStatus {
  projects {
    name
    goals {
      name
      goalProgressSchemas {
        community { name }
        progressSchemaStatuses {
          month
          status
        }
      }
    }
  }
}
Project report status

This query will return a list of projects and their quarterly reports.

query ProjectReportStatus {
  projects {
    name
    status
    projectReports {
      status
      approvalDate
      approver { name }
      startDate
      endDate
    }
  }
}
Project report responses

This query demonstrates how to access structured response data from project reports using the responseValues field. This field provides unified access to both simple field values and grid data.

query ProjectReportResponses {
  projects {
    name
    projectReports {
      id
      status
      responseValues {
        name
        value
        type
        gridName
        row
      }
    }
  }
}

The responseValues array contains all field responses with: - name: The field name from the template - value: The field value (JSON-decoded) - type: Either "simple" for regular fields or "grid" for grid row data - gridName: The grid name (only for grid fields) - row: The row identifier (only for grid fields)

Organisation partners

This query will return a list of organisation partners and selected subfields for demonstration purposes. Note that some attributes of the organisation partner object are also objects with their own attributes.

query OrganisationPartners {
  organisations {
    organisationPartners {
      isChurch
      targetDepth
      partnersReach
      organisationPartnerSectors
      projectPartners {
        projectPartnerRoles {
          id
        }
      }
      status
    }
  }
}
Scripture completion data

This is a query that returns data about scripture chapter completion or progress. It also introduces the concept of a MangoSelector, we will explore an example of its usage here.

query Q($filter: MangoSelector) {
  projects {
    id
    name
    goals {
      goalProgressSchemas {
        community {
          id
          name
        }
        productionPlanAndProgresses(query: { selector: $filter })
        {
          goalTitleGroup {
            id
            name
          }
          goalProductionStage {
            id
            standardStage {
              id
              name
            }
          }

          # The first is manually entered by a user, the
          # latter is calculated by the system. If `progress`
          # is null or zero then use `calculatedProgress`,
          # otherwise use `progress`.
          progress
          calculatedProgress
        }
      }
    }
  }
}

We need to pass a variable to $filter, we can do so in graphiql by entering it in the Variables tab. Your GraphQL client will provide their own method of passing in variables.

This is an example to specify the $filter variable in order to only select progress data for chapters belonging to a goal.

{
  "filter": {
    "$not": {
      "goalTitleGroupId": null
    }
  }
}