Skip to content

start_merge_cases

start_merge_cases(
    domain_id: DomainId,
    case_id: CaseId,
    secondary_case_ids: CaseIdList,
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    fields_configuration: Optional[FieldsConfigurationList] = None,
    related_items_configuration: Optional[RelatedItemsConfiguration] = None,
    performed_by: Optional[UserUnion] = None,
) -> StartMergeCasesResponse

Merges a secondary case into a primary case. The primary case, which you specify in the request URI, remains active. Both cases must belong to the same domain.

The merge runs asynchronously. To track its progress, call GetMergeCasesStatus. When the merge finishes, the selected field values and related items from the secondary case are on the primary case, the two cases are linked, and the secondary case is closed. Both cases record the merge in their audit history. For more information, see GetCaseAuditEvents.

Important things to know

  • Both cases must have the same customer, or at least one of them must have no customer.

  • While the merge runs, you can't modify the secondary case or its related items, and you can't delete the primary case. These requests return a ConflictException.

  • After the merge, the secondary case can be reopened, updated, and deleted, but it can't be merged again.

The request fails with a ValidationException, and no merge starts, if:

  • The primary case and the secondary case are the same case.

  • Either case is closed.

  • Both cases have a customer, and the customers are different.

  • fieldsConfiguration selects a field that can't be merged, or a field that the secondary case doesn't have.

  • After the merge, the primary case would have more than 500 field values, or would exceed the maximum case size.

The request fails with a ServiceQuotaExceededException if, after the merge, either case would exceed the quota for related items per case. For the primary case, the count is its existing related items, plus the related items moved from the secondary case, plus the new case link. See Connect Customer Cases quotas.

The request fails with a ConflictException if either case is already part of a merge that is running, or was previously merged into another case as the secondary case.

Endpoints: See Connect Customer endpoints and quotas.

Parameters:

  • domain_id (DomainId) –

    The unique identifier of the Cases domain.

  • case_id (CaseId) –

    The unique identifier of the primary case. The primary case remains active and receives the merged field values and related items. The cases can use different templates, and the primary case keeps its template.

  • secondary_case_ids (CaseIdList) –

    The unique identifier of the secondary case to merge into the primary case. The secondary case is closed when the merge finishes. Specify exactly one case ID.

  • fields_configuration (Optional[FieldsConfigurationList], default: None ) –

    The fields whose values to take from the secondary case. You can only merge custom fields and the following system fields: assigned_queue, assigned_user, summary, and case_reason. If you select any other system field, the request fails with a ValidationException.

    For each field that can be merged, the merge works as follows:

    • If you select the field, the primary case gets the secondary case's value. If the secondary case's value is empty, the primary case's value is cleared.

    • If you don't select the field and the primary case has a value for it, the primary case keeps its value.

    • If you don't select the field and the primary case doesn't have the field, or its value is empty, the primary case gets the secondary case's value. This applies even when the field isn't on the primary case's template.

    Field values are read from both cases when the merge runs, so changes that you make to the primary case after you start the merge are taken into account.

    Specify at most one entry, and set its sourceCaseId to the secondary case ID.

  • related_items_configuration (Optional[RelatedItemsConfiguration], default: None ) –

    The types of related items to move from the secondary case to the primary case. Related items of a type that you don't select, or set to false, stay on the closed secondary case. If you omit this parameter, no related items are moved.

    File, SLA, and work plan related items are never moved. They stay on the secondary case.

  • performed_by (Optional[UserUnion], default: None ) –

    The user who performed the merge. If you provide userArn, you must also have DescribeUser permission on the ARN of that user.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

  • InternalServerException –

    We couldn't process your request because of an issue with the server. Try again later.

  • ResourceNotFoundException –

    We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again.

  • ServiceQuotaExceededException –

    The service quota has been exceeded. For a list of service quotas, see Connect Customer Service Quotas in the Connect Customer Administrator Guide.

  • ThrottlingException –

    The rate has been exceeded for this API. Please try again after a few minutes.

  • ValidationException –

    The request isn't valid. Check the syntax and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_connectcases/_services/connect_cases.py
def start_merge_cases(
    self,
    domain_id: "capo_connectcases.types.domain_id.DomainId",
    case_id: "capo_connectcases.types.case_id.CaseId",
    secondary_case_ids: "capo_connectcases.types.case_id_list.CaseIdList",
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    fields_configuration: Optional[
        "capo_connectcases.types.fields_configuration_list.FieldsConfigurationList"
    ] = None,
    related_items_configuration: Optional[
        "capo_connectcases.types.related_items_configuration.RelatedItemsConfiguration"
    ] = None,
    performed_by: Optional["capo_connectcases.types.user_union.UserUnion"] = None,
) -> "capo_connectcases.types.start_merge_cases_response.StartMergeCasesResponse":
    """<p>Merges a secondary case into a primary case. The primary case, which you specify in the request URI, remains active. Both cases must belong to the same domain.</p> <p>The merge runs asynchronously. To track its progress, call <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-cases_GetMergeCasesStatus.html">GetMergeCasesStatus</a>. When the merge finishes, the selected field values and related items from the secondary case are on the primary case, the two cases are linked, and the secondary case is closed. Both cases record the merge in their audit history. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-cases_GetCaseAuditEvents.html">GetCaseAuditEvents</a>.</p> <p> <b>Important things to know</b> </p> <ul> <li> <p>Both cases must have the same customer, or at least one of them must have no customer.</p> </li> <li> <p>While the merge runs, you can't modify the secondary case or its related items, and you can't delete the primary case. These requests return a <code>ConflictException</code>.</p> </li> <li> <p>After the merge, the secondary case can be reopened, updated, and deleted, but it can't be merged again.</p> </li> </ul> <p>The request fails with a <code>ValidationException</code>, and no merge starts, if:</p> <ul> <li> <p>The primary case and the secondary case are the same case.</p> </li> <li> <p>Either case is closed.</p> </li> <li> <p>Both cases have a customer, and the customers are different.</p> </li> <li> <p> <code>fieldsConfiguration</code> selects a field that can't be merged, or a field that the secondary case doesn't have.</p> </li> <li> <p>After the merge, the primary case would have more than 500 field values, or would exceed the maximum case size.</p> </li> </ul> <p>The request fails with a <code>ServiceQuotaExceededException</code> if, after the merge, either case would exceed the quota for related items per case. For the primary case, the count is its existing related items, plus the related items moved from the secondary case, plus the new case link. See <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html#cases-quotas">Connect Customer Cases quotas</a>.</p> <p>The request fails with a <code>ConflictException</code> if either case is already part of a merge that is running, or was previously merged into another case as the secondary case.</p> <p> <b>Endpoints</b>: See <a href="https://docs.aws.amazon.com/general/latest/gr/connect_region.html">Connect Customer endpoints and quotas</a>.</p>

    Args:
        domain_id: <p>The unique identifier of the Cases domain. </p>
        case_id: <p>The unique identifier of the primary case. The primary case remains active and receives the merged field values and related items. The cases can use different templates, and the primary case keeps its template.</p>
        secondary_case_ids: <p>The unique identifier of the secondary case to merge into the primary case. The secondary case is closed when the merge finishes. Specify exactly one case ID.</p>
        fields_configuration: <p>The fields whose values to take from the secondary case. You can only merge custom fields and the following system fields: <code>assigned_queue</code>, <code>assigned_user</code>, <code>summary</code>, and <code>case_reason</code>. If you select any other system field, the request fails with a <code>ValidationException</code>.</p> <p>For each field that can be merged, the merge works as follows:</p> <ul> <li> <p>If you select the field, the primary case gets the secondary case's value. If the secondary case's value is empty, the primary case's value is cleared.</p> </li> <li> <p>If you don't select the field and the primary case has a value for it, the primary case keeps its value.</p> </li> <li> <p>If you don't select the field and the primary case doesn't have the field, or its value is empty, the primary case gets the secondary case's value. This applies even when the field isn't on the primary case's template.</p> </li> </ul> <p>Field values are read from both cases when the merge runs, so changes that you make to the primary case after you start the merge are taken into account.</p> <p>Specify at most one entry, and set its <code>sourceCaseId</code> to the secondary case ID.</p>
        related_items_configuration: <p>The types of related items to move from the secondary case to the primary case. Related items of a type that you don't select, or set to <code>false</code>, stay on the closed secondary case. If you omit this parameter, no related items are moved.</p> <p>File, SLA, and work plan related items are never moved. They stay on the secondary case.</p>
        performed_by: <p>The user who performed the merge. If you provide <code>userArn</code>, you must also have <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribeUser.html">DescribeUser</a> permission on the ARN of that user.</p>

    Raises:
        capo_connectcases.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_connectcases.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.</p>
        capo_connectcases.errors.internal_server_exception.InternalServerException: <p>We couldn't process your request because of an issue with the server. Try again later.</p>
        capo_connectcases.errors.resource_not_found_exception.ResourceNotFoundException: <p>We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again.</p>
        capo_connectcases.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded. For a list of service quotas, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html">Connect Customer Service Quotas</a> in the <i>Connect Customer Administrator Guide</i>.</p>
        capo_connectcases.errors.throttling_exception.ThrottlingException: <p>The rate has been exceeded for this API. Please try again after a few minutes.</p>
        capo_connectcases.errors.validation_exception.ValidationException: <p>The request isn't valid. Check the syntax and try again.</p>
        capo_connectcases.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connectcases.types.start_merge_cases_request.StartMergeCasesRequest]",
    ) -> OperationResponse[
        "capo_connectcases.types.start_merge_cases_response.StartMergeCasesResponse"
    ]:
        import capo_connectcases._operations.amazon_connect_cases.start_merge_cases

        output, http_response = (
            capo_connectcases._operations.amazon_connect_cases.start_merge_cases.start_merge_cases(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_connectcases.types.start_merge_cases_request.StartMergeCasesRequest",
    ) -> dict[str, Any]:
        import capo_connectcases.types.start_merge_cases_request

        return capo_connectcases.types.start_merge_cases_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartMergeCases", redact_input=_redact_input),
    )
    input_: capo_connectcases.types.start_merge_cases_request.StartMergeCasesRequest = {
        "domain_id": domain_id,
        "case_id": case_id,
        "secondary_case_ids": secondary_case_ids,
    }
    if fields_configuration is not None:
        input_["fields_configuration"] = fields_configuration
    if related_items_configuration is not None:
        input_["related_items_configuration"] = related_items_configuration
    if performed_by is not None:
        input_["performed_by"] = performed_by

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output