{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"<b>Required scope: </b><code>goals:write</code>\n\nCustom fields are associated with goals by way of custom field settings.  This method creates a setting for the goal.","properties":{"path":{"type":"object","properties":{"goal_gid":{"type":"string","examples":["12345"],"description":"Globally unique identifier for the goal."}},"required":["goal_gid"],"additionalProperties":false},"query":{"type":"object","properties":{"opt_pretty":{"type":"boolean","examples":[true],"description":"Provides “pretty” output.\nProvides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging."}},"required":[],"additionalProperties":false},"body":{"type":"object","properties":{"data":{"$ref":"#/definitions/AddCustomFieldSettingRequest"}}}},"required":["path","body"],"additionalProperties":false,"definitions":{"AddCustomFieldSettingRequest":{"type":"object","required":["custom_field"],"properties":{"custom_field":{"oneOf":[{"type":"string","description":"The custom field to associate with this container.","examples":["14916"]},{"$ref":"#/definitions/CustomFieldCreateRequest"}]},"is_important":{"description":"Whether this field should be considered important to this container (for instance, to display in the list view of items in the container).","type":"boolean","examples":[true]},"insert_before":{"description":"A gid of a Custom Field Setting on this container, before which the new Custom Field Setting will be added.  `insert_before` and `insert_after` parameters cannot both be specified.","type":"string","examples":["1331"]},"insert_after":{"description":"A gid of a Custom Field Setting on this container, after which the new Custom Field Setting will be added.  `insert_before` and `insert_after` parameters cannot both be specified.","type":"string","examples":["1331"]}}},"CustomFieldCreateRequest":{"allOf":[{"$ref":"#/definitions/CustomFieldRequest"},{"type":"object","required":["resource_subtype"],"properties":{"resource_subtype":{"description":"The type of the custom field. Must be one of the given values.","type":"string","enum":["text","enum","multi_enum","number","date","people","reference"],"examples":["text"]}}}]},"CustomFieldRequest":{"allOf":[{"$ref":"#/definitions/CustomFieldBase"},{"type":"object","required":["workspace"],"properties":{"workspace":{"type":"string","description":"*Create-Only* The workspace to create a custom field in.","examples":["1331"]},"owned_by_app":{"type":"boolean","description":"*Allow-listed*. Instructs the API that this Custom Field is app-owned. This parameter is allow-listed to specific apps at this point in time. For apps that are not allow-listed, providing this parameter will result in a `403 Forbidden`."},"people_value":{"description":"*Conditional*. Only relevant for custom fields of type `people`. This array of user GIDs, emails, or the string \"me\", reflects the users to be written to a `people` custom field. Note that *write* operations will replace existing users (if any) in the custom field with the users specified in this array.","type":"array","items":{"type":"string","description":"A string identifying a user. This can either be the string \"me\", an email, or the gid of a user."},"examples":[["12345"]]},"reference_value":{"description":"*Conditional*. Only relevant for custom fields of type `reference`. This array of GIDs reflects the objects to be written to a `reference` custom field. Note that *write* operations will replace existing objects (if any) in the custom field with the objects specified in this array.","type":"array","items":{"type":"string","description":"The GID of an object."},"examples":[["12345"]]}}}]},"CustomFieldBase":{"allOf":[{"$ref":"#/definitions/CustomFieldCompact"},{"type":"object","properties":{"description":{"description":"[Opt In](/docs/inputoutput-options). The description of the custom field.","type":"string","examples":["Development team priority"]},"enum_options":{"description":"*Conditional*. Only relevant for custom fields of type `enum` or `multi_enum`. This array specifies the possible values which an `enum` custom field can adopt. To modify the enum options, refer to [working with enum options](/reference/createenumoptionforcustomfield).","type":"array","items":{"$ref":"#/definitions/EnumOption"}},"precision":{"description":"Only relevant for custom fields 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.\nFor 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%.\nThe identifier format will always have a precision of 0.","type":"integer","examples":[2]},"format":{"description":"The format of this custom field.","type":"string","enum":["currency","identifier","percentage","custom","duration","none"],"examples":["custom"]},"currency_code":{"description":"ISO 4217 currency code to format this custom field. This will be null if the `format` is not `currency`.","type":["string","null"],"examples":["EUR"]},"custom_label":{"description":"This is the string that appears next to the custom field value. This will be null if the `format` is not `custom`.","type":["string","null"],"examples":["gold pieces"]},"custom_label_position":{"description":"Only relevant for custom fields with `custom` format. This depicts where to place the custom label. This will be null if the `format` is not `custom`.","type":["string","null"],"enum":["prefix","suffix",null],"examples":["suffix"]},"has_notifications_enabled":{"description":"*Conditional*. This flag describes whether a follower of a task with this field should receive inbox notifications from changes to this field.","type":"boolean","examples":[true]}}}]},"CustomFieldCompact":{"description":"Custom Fields store the metadata that is used in order to add user-specified information to tasks in Asana. Be sure to reference the [custom fields](/reference/custom-fields) developer documentation for more information about how custom fields relate to various resources in Asana.\n\nUsers in Asana can [lock custom fields](https://asana.com/guide/help/premium/custom-fields#gl-lock-fields), which will make them read-only when accessed by other users. Attempting to edit a locked custom field will return HTTP error code `403 Forbidden`.","type":"object","properties":{"name":{"description":"The name of the custom field.","type":"string","examples":["Status"]},"enum_options":{"description":"*Conditional*. Only relevant for custom fields of type `enum` or `multi_enum`. This array specifies the possible values which an `enum` custom field can adopt. To modify the enum options, refer to [working with enum options](/reference/createenumoptionforcustomfield).","type":"array","items":{"$ref":"#/definitions/EnumOption"}},"id_prefix":{"description":"This field is the unique custom ID string for the custom field.","type":["string","null"],"examples":["ID"]},"input_restrictions":{"type":"array","items":{"description":"*Conditional*. Only relevant for custom fields of type `reference`. This array of strings reflects the allowed types of objects that can be written to a `reference` custom field value.","type":"string","enum":["task","project","portfolio","goal"]},"examples":[["task"]]},"is_formula_field":{"description":"*Conditional*. This flag describes whether a custom field is a formula custom field.","type":"boolean","examples":[false]},"is_lookup_field":{"description":"*Conditional*. This flag describes whether a custom field is a lookup custom field.","type":"boolean","examples":[false]},"date_value":{"description":"*Conditional*. Only relevant for custom fields of type `date`. This object reflects the chosen date (and optionally, time) value of a `date` custom field. If no date is selected, the value of `date_value` will be `null`.","type":["object","null"],"properties":{"date":{"type":"string","description":"A string representing the date in YYYY-MM-DD format.","examples":["2024-08-23"]},"date_time":{"type":"string","description":"A string representing the date in ISO 8601 format. If no time value is selected, the value of `date-time` will be `null`.","examples":["2024-08-23T22:00:00.000Z"]}}},"enum_value":{"allOf":[{"$ref":"#/definitions/EnumOption"},{"type":["object","null"],"description":"*Conditional*. Only relevant for custom fields of type `enum`. This object is the chosen value of an `enum` custom field."}]},"multi_enum_values":{"description":"*Conditional*. Only relevant for custom fields of type `multi_enum`. This object is the chosen values of a `multi_enum` custom field.","type":"array","items":{"$ref":"#/definitions/EnumOption"}},"number_value":{"description":"*Conditional*. This number is the value of a `number` custom field.","type":["number","null"],"examples":[5.2]},"text_value":{"description":"*Conditional*. This string is the value of a `text` custom field.","type":["string","null"],"examples":["Some Value"]}}},"EnumOption":{"description":"Enum options are the possible values which an enum custom field can adopt. An enum custom field must contain at least 1 enum option but no more than 500.\n\nYou can add enum options to a custom field by using the `POST /custom_fields/custom_field_gid/enum_options` endpoint.\n\n**It is not possible to remove or delete an enum option**. Instead, enum options can be disabled by updating the `enabled` field to false with the `PUT /enum_options/enum_option_gid` endpoint. Other attributes can be updated similarly.\n\nOn creation of an enum option, `enabled` is always set to `true`, meaning the enum option is a selectable value for the custom field. Setting `enabled=false` is equivalent to “trashing” the enum option in the Asana web app within the “Edit Fields” dialog. The enum option will no longer be selectable but, if the enum option value was previously set within a task, the task will retain the value.\n\nEnum options are an ordered list and by default new enum options are inserted at the end. Ordering in relation to existing enum options can be specified on creation by using `insert_before` or `insert_after` to reference an existing enum option. Only one of `insert_before` and `insert_after` can be provided when creating a new enum option.\n\nAn enum options list can be reordered with the `POST /custom_fields/custom_field_gid/enum_options/insert` endpoint.","type":"object","properties":{"name":{"description":"The name of the enum option.","type":"string","examples":["Low"]},"enabled":{"description":"Whether or not the enum option is a selectable value for the custom field.","type":"boolean","examples":[true]},"color":{"description":"The color of the enum option. Defaults to `none`.","type":"string","examples":["blue"]}}}}},"name":"Add a custom field to a goal","id":"asana.addcustomfieldsettingforgoal","example":{"path":{"goal_gid":"12345"},"body":{}},"maxRequests":1,"summary":false}}