Magidoc

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

workspace

ID !
Non-null

The workspace ID where this goal will be created

owners

[ ID !]!
Non-null

User IDs who own this goal (must contain at least one element; empty arrays are not allowed and will be rejected at runtime)

teamOwners

[ ID !]!
Non-null

Team IDs who own this goal

name

Non-null

Goal name (cannot be empty string)

parentId

Parent goal ID if this is a sub-goal

description

Non-null

Goal description in HTML format

initialValue

Non-null

Initial numeric value for the goal

currentValue

Non-null

Current numeric value for the goal

goalValue

Non-null

Target numeric value for the goal

startDate

Start date (requires endDate if provided)

endDate

End date (required if startDate provided, must be after startDate)

ongoingDate

Whether goal is ongoing (cannot combine with recurringDate or start/endDate)

recurringDate

Recurring schedule (cannot combine with ongoingDate or start/endDate)

measurementType

How goal value is measured (null, number, actions, status, overdue)

measurementUnit

Unit for measurement (currency, percentage, custom, actions, projects, subGoals)

measurementUnitValue

Non-null

Specific value for the unit (e.g., 'USD', 'percentage', 'actions', 'projects', '' for subGoals)

measurementUnitSymbol

Non-null

Symbol for the unit (e.g., '$', '%', '€', '¥', '£', 'AU$')

displayType

Non-null

How goal is displayed (number, progress, status)

actionIds = []

[ ID !]

Action IDs to track (requires measurementType actions/overdue + measurementUnit actions + measurementUnitValue 'actions')

includeSubActions

Whether to include sub-actions in tracking

projectIds = []

[ ID !]

Project IDs to track (requires measurementType actions/overdue + measurementUnit projects + measurementUnitValue 'projects')

sharingType

Who can access this goal (me, custom, everyone)

sharingWith = []

[ ID !]

User IDs to share with (only valid when sharingType is custom)

isAutomated

Whether this goal was created automatically

Response

#

Returns Goal .

Example

#

    
  

3

    
  

3

    
  

3