Queries
Get all the form definitions in a published pathway
This query allows us to fetch the form details for all form defintions in a published care flow/pathway. Want to learn more about how to display the form in your UI and conditionally show/hide the correct questions based on the response? Click here!
Please note that this query returns all forms in a published care flow or pathway but that this doesn't necessarily mean that all these forms will be completed as that is dependent on the logic built into the care flow.
See the example below:
Form and question metadata is returned in all form queries as a JSON string rather than a JSON object. This is because the metadata is defined in Studio as a JSON string and we want to avoid any potential parsing errors. You can parse the metadata string into a JSON object in your application (for example, using JSON.parse
in JavaScript/TypeScript, json.loads
in Python or json_decode
in PHP or Ruby).
- graphql
01query GetFormsForPublishedPathway(02 $pathway_definition_id: String!03 $release_id: String04) {05 forms(06 pathway_definition_id: $pathway_definition_id07 release_id: $release_id08 ) {09 forms {10 id11 definition_id # static id from Studio12 title13 key # form key set in Studio14 metadata # JSON metadata string set in Studio15 questions {16 id17 definition_id # static id from Studio18 title # string or html string (for description questions)19 key # question key set in Studio20 dataPointValueType21 questionType22 metadata # JSON metadata string set in Studio23 options {24 id25 value26 label27 }28 rule {29 # visibility conditions of a question30 boolean_operator31 conditions {32 id33 reference # definition id of the question this condition is based on34 operator35 operand {36 type37 value38 }39 }40 }41 }42 }43 }44}
The release_id
is optional. If not specified, we return the forms for the latest published version of the care flow or pathway.
- json
01{02 "pathway_definition_id": "{{PATHWAY_DEFINITION_ID}}",03 "release_id": "{{PATHWAY_RELEASE_ID}}"04}