+ Start a Discussion
Ron Mccrerey 20Ron Mccrerey 20 

Object OpportunityContactRole is not supported in UI API

Get the above error when trying to create an OpportunityContactRole record using LWC.

javascript Code

import retrieveOppContactRoles from '@salesforce/apex/getLastIncrementSTENum.getOppContactRoles';

let fields = {
ContactId: iterator.ContactId,
OpportunityId: oppId
}

createRecord({apiName: OPPORTUNITY_CONTACT_ROLE_OBJECT.objectApiName, fields })
.catch(error =>{ console.log( error); });

Error in Console
body:
errorCode: "INVALID_TYPE"
message: "Object OpportunityContactRole is not supported in UI API"
statusCode: 400