Skip to content

Asana: Create a goal metric

Asana goals.createGoalMetric: arguments, response, policy and SDK examples.

← Goals operations · Get started

Operation asana.creategoalmetric

Provider route: POST /goals/{goal_gid}/setMetric. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/asana with npm, or alter-sdk-asana with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { AsanaIntegration } from "@alter-ai/asana";
async function execute(input: Parameters<AsanaIntegration["goals"]["createGoalMetric"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new AsanaIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.goals.createGoalMetric(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_asana import AsanaIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = AsanaIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.goals.create_goal_metric(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.goal_gidstringRequired within parent
queryModelOptionalExpand Get a goal — request body — query
bodyobjectRequired within parent
body.dataModelOptionalExpand Create a goal metric — request body — body data

Referenced models: Create a goal metric — request body — body data, Get a goal — request body — query

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$JSONRoot
$ (allOf 1)objectAll variants apply
$ (allOf 1).dataModelOptionalExpand Get a goal — response body — data data — Goal Response
$ (allOf 2)ModelAll variants applyExpand Get a goal — response body — data

Referenced models: Get a goal — response body — data data — Goal Response, Get a goal — response body — data

32 more schemas are linked from the tables above, on the schema pages.

Create a goal metric — request body — body data
FieldTypePresenceDescription and constraints
$objectRootA generic Asana Resource, containing a globally unique identifier.
gidstringOptionalGlobally unique identifier of the resource, as a string.
Read only: true
resource_typestringOptionalThe base type of this resource.
Read only: true
resource_subtypestringOptionalThe subtype of this resource. Different subtypes retain many of the same fields and behavior, but may render differently in Asana or represent resources with different semantic meaning.
Read only: true
One of: number
precisionintegerOptional*Conditional*. Only relevant for goal metrics of type `Number`. This field dictates the number of places after the decimal to round to, i.e. 0 is integer values, 1 rounds to the nearest tenth, and so on. Must be between 0 and 6, inclusive.
For percentage format, this may be unintuitive, as a value of 0.25 has a precision of 0, while a value of 0.251 has a precision of 1. This is due to 0.25 being displayed as 25%.
unitstringOptionalA supported unit of measure for the goal metric, or none.
One of: none, currency, percentage
currency_codeJSONOptional
currency_code (anyOf 1)stringAlternativeISO 4217 currency code to format this custom field. This will be null if the `unit` is not `currency`.
currency_code (anyOf 2)nullAlternative
initial_number_valuenumberOptionalThis number is the start value of a goal metric of type number.
target_number_valuenumberOptionalThis number is the end value of a goal metric of type number. This number cannot equal `initial_number_value`.
current_number_valuenumberOptionalThis number is the current value of a goal metric of type number.
current_display_valuestringOptionalThis string is the current value of a goal metric of type string.
Read only: true
progress_sourcestringOptionalThis field defines how the progress value of a goal metric is being calculated. A goal's progress can be provided manually by the user, calculated automatically from contributing subgoals, projects, or tasks, or managed by an integration with an external data source, such as Salesforce.
One of: manual, subgoal_progress, project_task_completion, project_milestone_completion, task_completion, external
is_custom_weightbooleanOptional*Conditional*. Only relevant if `metric.progress_source` is one of `subgoal_progress`, `project_task_completion`, `project_milestone_completion`, or `task_completion`. If true, we use the supporting object's custom weight to calculate the goal's progress. If false, we treat all supporting objects as equally weighted
Get a goal — response body — data data — Goal Response
FieldTypePresenceDescription and constraints
$JSONRoot
$ (allOf 1)ModelAll variants applyExpand Get a goal — response body — data data due on, gid, html notes, is workspace level, liked, name, notes, resource type, start on
$ (allOf 2)objectAll variants apply
$ (allOf 2).likesarrayOptionalArray of likes for users who have liked this goal.
Read only: true
$ (allOf 2).likes[]ModelEach itemExpand Get a story — response body — data / data / source: web, email, mobile, api, unknown, type: comment, system likes item
$ (allOf 2).num_likesJSONOptional
$ (allOf 2).num_likes (anyOf 1)integerAlternativeThe number of users who have liked this goal.
Read only: true
$ (allOf 2).num_likes (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
$ (allOf 2).teamJSONOptional
$ (allOf 2).team (anyOf 1)JSONAlternative
$ (allOf 2).team (anyOf 1) (allOf 1)ModelAll variants applyExpand Add a user to a team — response body — data data team — Team Compact
$ (allOf 2).team (anyOf 1) (allOf 2)objectAll variants apply*Conditional*. This property is only present when the `workspace` provided is an organization.
$ (allOf 2).team (anyOf 2)nullAlternative
$ (allOf 2).workspaceJSONOptional
$ (allOf 2).workspace (allOf 1)ModelAll variants applyExpand Update a workspace — request body — body data
$ (allOf 2).workspace (allOf 2)objectAll variants apply
$ (allOf 2).followersarrayOptionalArray of users who are members of this goal.
$ (allOf 2).followers[]ModelEach itemExpand Get users in a team — response body — data data item
$ (allOf 2).time_periodJSONOptional
$ (allOf 2).time_period (anyOf 1)JSONAlternative
$ (allOf 2).time_period (anyOf 1) (allOf 1)ModelAll variants applyExpand Get time periods — response body — data, next page data item
$ (allOf 2).time_period (anyOf 1) (allOf 2)objectAll variants apply
$ (allOf 2).time_period (anyOf 2)nullAlternative
$ (allOf 2).metricJSONOptional
$ (allOf 2).metric (anyOf 1)JSONAlternative
$ (allOf 2).metric (anyOf 1) (allOf 1)ModelAll variants applyExpand Get a goal — response body — data / data / default_access_level: admin, editor, commenter, viewer, privacy setting: public to workspace, members only metric resource subtype: number, unit: none, currency, percentage resource subtype: number, unit: none, currency, percentage
$ (allOf 2).metric (anyOf 1) (allOf 2)objectAll variants apply
$ (allOf 2).metric (anyOf 1) (allOf 2).can_managebooleanOptional*Conditional*. Only relevant for `progress_source` of type `external`. This boolean indicates whether the requester has the ability to update the current value of this metric. This returns `true` if the external metric was created by the requester, `false` otherwise.
Read only: true
$ (allOf 2).metric (anyOf 2)nullAlternative
$ (allOf 2).ownerJSONOptional
$ (allOf 2).owner (anyOf 1)JSONAlternative
$ (allOf 2).owner (anyOf 1) (allOf 1)ModelAll variants applyExpand Get users in a team — response body — data data item
$ (allOf 2).owner (anyOf 1) (allOf 2)objectAll variants apply
$ (allOf 2).owner (anyOf 2)nullAlternative
$ (allOf 2).current_status_updateJSONOptional
$ (allOf 2).current_status_update (anyOf 1)JSONAlternative
$ (allOf 2).current_status_update (anyOf 1) (allOf 1)ModelAll variants applyExpand Get status updates from an object — response body — data, next page data item
$ (allOf 2).current_status_update (anyOf 1) (allOf 2)JSONAll variants applyThe latest `status_update` posted to this goal.
$ (allOf 2).current_status_update (anyOf 2)nullAlternative
$ (allOf 2).statusJSONOptional
$ (allOf 2).status (anyOf 1)stringAlternativeThe current status of this goal. When the goal is open, its status can be `green`, `yellow`, and `red` to reflect "On Track", "At Risk", and "Off Track", respectively. When the goal is closed, the value can be `missed`, `achieved`, `partial`, or `dropped`.
*Note* you can only write to this property if `metric` is set.
Read only: true
$ (allOf 2).status (anyOf 2)nullAlternative
$ (allOf 2).privacy_settingstringOptionalThe privacy setting of the goal.
Known values: public_to_workspace, members_only
$ (allOf 2).default_access_levelstringOptionalThe default access level when inviting new members to the goal
Known values: admin, editor, commenter, viewer
$ (allOf 2).custom_fieldsarrayOptionalArray of custom field values applied directly to the goal itself. These represent the values set on the goal, not the fields available for items in the goal.
$ (allOf 2).custom_fields[]ModelEach itemExpand Get a membership — response body — data / data / access_level: admin, editor, user parent
$ (allOf 2).custom_field_settingsarrayOptionalArray of custom field definitions that are enabled for the goal. These represent which custom fields are available to be used on items within the goal, but do not include any values.
$ (allOf 2).custom_field_settings[]ModelEach itemExpand Add a custom field to a project — response body — data data — Custom Field Setting Response

Referenced models: Get a goal — response body — data data due on, gid, html notes, is workspace level, liked, name, notes, resource type, start on, Get a story — response body — data / data / source: web, email, mobile, api, unknown, type: comment, system likes item, Get a membership — response body — data / data / access_level: admin, editor, user parent, Add a custom field to a project — response body — data data — Custom Field Setting Response, Get a goal — response body — data / data / default_access_level: admin, editor, commenter, viewer, privacy setting: public to workspace, members only metric resource subtype: number, unit: none, currency, percentage resource subtype: number, unit: none, currency, percentage, Get status updates from an object — response body — data, next page data item, Add a user to a team — response body — data data team — Team Compact, Get time periods — response body — data, next page data item, Get users in a team — response body — data data item, Update a workspace — request body — body data

SDK function policy ID: asana.creategoalmetric. Catalog operation: asana:createGoalMetric. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.