createGoal Mutation
Create a new goal with comprehensive validation rules
IMPORTANT VALIDATION RULES:
Display Type Rules:
- progress: Only works with measurementType null, number, or actions
- number: Only works with measurementType null, number, actions, or overdue
- status: Only works with measurementType status
Measurement Type + Unit Combinations:
- measurementType actions/overdue: Must use measurementUnit actions OR projects
- measurementType number: Must use measurementUnit currency, custom, OR percentage
- measurementType status: Must use measurementUnit subGoals
Measurement Unit + Value + Symbol Rules:
- measurementUnit currency: measurementUnitValue must be one of the supported currency codes (e.g., USD/EUR/JPY/GBP/AUD), symbol $/€/¥/£/AU$ This list is not exhaustive. For additional currencies, specify the ISO 4217 currency code as measurementUnitValue and provide the appropriate symbol. Refer to the application's documentation or configuration for the full list of supported currencies and symbols.
- measurementUnit percentage: measurementUnitValue must be 'percentage', symbol '%'
- measurementUnit actions: measurementUnitValue must be 'actions'
- measurementUnit projects: measurementUnitValue must be 'projects'
- measurementUnit subGoals: measurementUnitValue must be the empty string ("")
- measurementUnit custom: measurementUnitValue can be any string
Action/Project ID Rules:
- actionIds: Requires measurementType actions/overdue + measurementUnit actions + measurementUnitValue 'actions'
- projectIds: Requires measurementType actions/overdue + measurementUnit projects + measurementUnitValue 'projects'
Date Rules:
- Cannot be both ongoingDate AND recurringDate
- Cannot combine ongoingDate with startDate/endDate
- Cannot combine recurringDate with startDate/endDate
- If startDate provided, endDate is required
- startDate must be before endDate
Arguments
#
_id
owners
User IDs who own this goal (must contain at least one element; empty arrays are not allowed and will be rejected at runtime)
recurringDate
Recurring schedule (cannot combine with ongoingDate or start/endDate)
measurementUnit
Unit for measurement (currency, percentage, custom, actions, projects, subGoals)
measurementUnitValue
Specific value for the unit (e.g., 'USD', 'percentage', 'actions', 'projects', '' for subGoals)
actionIds = []
Action IDs to track (requires measurementType actions/overdue + measurementUnit actions + measurementUnitValue 'actions')
projectIds = []
Project IDs to track (requires measurementType actions/overdue + measurementUnit projects + measurementUnitValue 'projects')
Response
#
Returns Goal .
Example
#
createForm