---
schema_version: "1"
id: 18ec61dbce975dbcddd27eeadf7a77c3a5b8455178d0b1ed2f2971b01c348807
title: createComplaint(complaintMgmtRequestData)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/financial_services_cloud_object_reference/apex_ConnectAPI_IComplaintMgmtConnectFamily_createComplaint_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/apex_ConnectAPI_IComplaintMgmtConnectFamily_createComplaint_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4e05c090d2eb94c17d46c3e4ea97d8909da4d7572f814cdd8b24c40d09384d3f
description: Create a customer complaint.
---
# createComplaint(complaintMgmtRequestData)

Create a customer complaint.

## API Version

58.0

## Requires Chatter

No

## Signature

public static ConnectApi.ComplaintMgmtOutputRepresentation createComplaint(ConnectApi.ComplaintMgmtRequestInputRepresentation complaintMgmtRequestData)

## Parameters

complaintMgmtRequestData

Type: [ConnectApi.ComplaintMgmtRequestInputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/apex_connectapi_input_complaint_mgmt.htm "Input representation of the request to create a public complaint.")

Input representation of the request to create a public complaint.

## Return Value

Type: [ConnectApi.ComplaintMgmtOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/apex_connectapi_output_complaint_mgmt_output.htm "Output representation of the created public complaint.")

## Example

ConnectApi.ComplaintMgmtRequestInputRepresentation input = new ConnectApi.ComplaintMgmtRequestInputRepresentation();
input.assessmentId='0U3RO0000000Cp20AE';

//caseInfo
ConnectApi.CaseInfoWrapper caseInfo=new ConnectApi.CaseInfoWrapper();
caseInfo.additionalInfo = new Map<String, ConnectApi.GenericObjectWrapper>();
ConnectApi.GenericObjectWrapper caseReason= new ConnectApi.GenericObjectWrapper();
                  caseReason.value='case reason';
                  caseInfo.additionalInfo.put('Reason', caseReason);
caseInfo.accountId='001RO000004WKi1YAG';
caseInfo.subject='Reversal of Account Annual Maintenance Charges';
caseInfo.status='Pending';
caseInfo.description='Annual maintenance charges to be reversed';
caseInfo.origin='Email';
caseInfo.reason='Other';
input.caseInfo = new ConnectApi.CaseInfoWrapper();

//complaintInfo
ConnectApi.ComplaintInfoWrapper complaintInfo=new ConnectApi.ComplaintInfoWrapper();
complaintInfo.incidentDate = '2022-04-07';
complaintInfo.type = 'Information, sums/charges or product performance';
complaintInfo.subType = 'Product disclosure information';
complaintInfo.status = 'In Progress';
complaintInfo.subject = 'Account Annual Maintenance Charges';
complaintInfo.priority = 'High';
complaintInfo.description = 'Annual maintenance charges not disclosed upfront';
complaintInfo.email = 'Tody@email.com';
complaintInfo.productTye = 'Credit Card or Prepaid Card';
complaintInfo.additionalInfo=new Map<String, ConnectApi.GenericObjectWrapper>();
ConnectApi.GenericObjectWrapper sourceTypeObj= new ConnectApi.GenericObjectWrapper();
                    sourceTypeObj.value=sourceType;
                    complaintInfo.additionalInfo.put('SourceType', sourceTypeObj);
input.complaintInfo = new ConnectApi.ComplaintInfoWrapper();


//caseParticipantInfo
input.caseParticipantInfo = new List<ConnectApi.CaseParticipantInfoWrapper>();
ConnectApi.CaseParticipantInfoWrapper caseParticipantInfo = new ConnectApi.CaseParticipantInfoWrapper();
caseParticipantInfo.participantId = '001RO000004KYfrYAG';
caseParticipantInfo.role = 'Complainant Representative';
caseParticipantInfo.status = 'Pending';
caseParticipantInfo.preferredCallTimeFrom = '10:30:30';
caseParticipantInfo.preferredCallTimeTo = '12:30:30';
caseParticipantInfo.preferredCommunicationMode = 'Email';
caseParticipantInfo.authorizationProof = 'Email';
input.caseParticipantInfo.add(caseParticipantInfo);

//documentInfoAttributes
ConnectApi.DocumentInfoAttributesWrapper doc1=new ConnectApi.DocumentInfoAttributesWrapper();
doc1.id='069RO00000048wfYAA';
doc1.name='PAN';
doc1.typeId='0deRO00000000J7YAI';

//documentInfoAttributesList
input.documentInfo=new List<ConnectApi.DocumentInfoAttributesWrapper>();
input.documentInfo.add(doc1);

input.shouldInclInRegulatoryRpt=true;
System.debug(ConnectApi.IComplaintMgmtConnectFamily.createComplaint(input));