---
schema_version: "1"
id: 36786e96d8a10e00c1fe6c4990309170428d90f1a6735b0e303e5c20f737ea1d
title: TopicAssignment
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_topicassignment.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_topicassignment.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e006bbd7a1de572fcc2c78099786ec4c066a7a1a22a082a5e00af369acc0e362
description: Represents the assignment of a topic to a specific feed item, record, or file. This object is available in API version 28.0 and later.
---
# TopicAssignment

Represents the assignment of a topic to a specific feed item, record, or file. This object is available in API version 28.0 and later.

Administrators must enable topics for objects before users can add topics to records of that object type. Topics for most objects are available in API version 30.0 and later. Topics for ContentDocument are available in API version 37.0 and later.

## Supported Calls

create(), describeSObjects(), delete(), getDeleted(), getUpdate(), query(), retrieve()

## Fields

| Field Name | Details |
| --- | --- |
| EntityId | 
Type

reference

Properties

Create, Filter, Group, Sort

Description

Identifier of the feed item, record, or file.

This is a polymorphic relationship field.

Relationship Name

Entity

Relationship Type

Lookup

Refers To

Account, Asset, Campaign, Case, Contact, ContentDocument, Contract, Event, FeedItem, Lead, Opportunity, Order, ProductItem, ProductItemTransaction, ProductRequest, ProductRequestLineItem, ProductRequired, ProductTransfer, ResourceAbsence, ResourcePreference, ReturnOrder, ReturnOrderLineItem, ServiceAppointment, ServiceResource, ServiceResourceSkill, ServiceTerritory, ServiceTerritoryMember, Shift, Shipment, Solution, Task, WorkOrder, WorkOrderLineItem



 |
| EntityKeyPrefix | 

Type

string

Properties

Filter, Group, idLookup, Sort

Description

The first three digits of the EntityID field, which identify the object type (account, opportunity, etc). This read-only field is available in API version 32.0 and later.

Interface label is “Record Key Prefix,” which appears only in reports.





 |
| EntityType | 

Type

string

Properties

Filter, Group, Nillable, Sort

Description

The standard name for the object type (account, opportunity, etc). This read-only field is available in API version 33.0 and later.

![Note](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)

#### Note

Querying topic assignments for the ManagedContentVersion entity type isn’t supported.

Interface label is “Object Type,” which appears only in reports.

![Tip](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note_tip.png)

#### Tip

In most cases, you should use this field rather than EntityKeyPrefix, which exists primarily to support older reports.















 |
| NetworkId | 

Type

reference

Properties

Create, Filter, Group, Nillable, Sort

Description

Identifier of the community to which the TopicAssignment belongs. This field is available only if digital experiences is enabled in your org.



 |
| TopicId | 

Type

reference

Properties

Create, Filter, Group, Sort

Description

Identifier of the topic.

This is a relationship field.

Relationship Name

Topic

Relationship Type

Lookup

Refers To

Topic



 |

## Usage

Use this object to query the assignments of topics to feed items, records, or files. To assign or remove topics, you must have the “Assign Topics” permission.

In SOQL SELECT syntax, this object supports nested semi-joins, allowing queries on Knowledge articles assigned to specific topics. For example:

SELECT parentId FROM KnowledgeArticleViewStat
    WHERE parentId in (SELECT KnowledgeArticleId FROM KnowledgeArticleVersion
    WHERE publishStatus = 'Online' AND language = 'en\_US'
    AND  Id in (select EntityId from TopicAssignment where TopicId ='0T0xx0000000xxx'))

There is no SOQL limit if the logged-in user has the “View All Data” permission. If they do have that permission, do one of the following:

- Specify a LIMIT clause of 1,100 records or fewer.
- Filter on Id or Entity when using a WHERE clause with "=".

![Important](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note_important.png)

#### Important

Deleting this object's records removes all its data. This action is irreversible.

![Note](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)

#### Note

When you create a report type on the TopicAssignment object, all queries are generated in SQL, which does not enforce the 1,100 record limit clause.

#### See Also

- [Topic](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_topic.htm "Represents a topic on a Chatter post or record. This object is available in API version 28.0 and later.")
- [FeedItem](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_feeditem.htm "FeedItem represents an entry in the feed, such as changes in a record feed, including text posts, link posts, and content posts. This object is available in API version 21.0 and later. This object replaces FeedPost.")