createRelatedItem method

Future<CreateRelatedItemResponse> createRelatedItem({
  1. required String caseId,
  2. required RelatedItemInputContent content,
  3. required String domainId,
  4. required RelatedItemType type,
  5. UserUnion? performedBy,
})

Creates a related item (comments, tasks, and contacts) and associates it with a case.

There's a quota for the number of fields allowed in a Custom type related item. See Amazon Connect Cases quotas.

Use cases

Following are examples of related items that you may want to associate with a case:

  • Related contacts, such as calls, chats, emails tasks
  • Comments, for agent notes
  • SLAs, to capture target resolution goals
  • Cases, to capture related Amazon Connect Cases
  • Files, such as policy documentation or customer-provided attachments
  • Custom related items, which provide flexibility for you to define related items that such as bookings, orders, products, notices, and more
Important things to know
  • If you are associating a contact to a case by passing in Contact for a type, you must have DescribeContact permission on the ARN of the contact that you provide in content.contact.contactArn.
  • A Related Item is a resource that is associated with a case. It may or may not have an external identifier linking it to an external resource (for example, a contactArn). All Related Items have their own internal identifier, the relatedItemArn. Examples of related items include comments and contacts.
  • If you provide a value for performedBy.userArn you must also have DescribeUser permission on the ARN of the user that you provide.
  • The type field is reserved for internal use only.
Endpoints: See Amazon Connect endpoints and quotas.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter caseId : A unique identifier of the case.

Parameter content : The content of a related item to be created.

Parameter domainId : The unique identifier of the Cases domain.

Parameter type : The type of a related item.

Parameter performedBy : Represents the creator of the related item.

Implementation

Future<CreateRelatedItemResponse> createRelatedItem({
  required String caseId,
  required RelatedItemInputContent content,
  required String domainId,
  required RelatedItemType type,
  UserUnion? performedBy,
}) async {
  final $payload = <String, dynamic>{
    'content': content,
    'type': type.value,
    if (performedBy != null) 'performedBy': performedBy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/domains/${Uri.encodeComponent(domainId)}/cases/${Uri.encodeComponent(caseId)}/related-items/',
    exceptionFnMap: _exceptionFns,
  );
  return CreateRelatedItemResponse.fromJson(response);
}