+ Start a Discussion
The new LearnerThe new Learner 

how to create a record on selection of record type in lwc

Hi Experts,
I need to create a record on the selection of record type,  I have created a Combobox and populated the record type, now my requirement is that on the selection of that record type I need to create a record.
    <div if:true={objectInfo.data}>
        <lightning-combobox name="recordType" label="Record Type" placeholder="Choose Status"

import { LightningElement, track, wire, api } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import CONTACT_OBJECT from '@salesforce/schema/Support_Request__c';

export default class CreateContact extends LightningElement {

    @track statusOptions;
    @track value;
    @api objectApiName;

    @track objectInfo;

    @wire(getObjectInfo, { objectApiName: CONTACT_OBJECT,})

    get recordTypeId1() {
        var recordtypeinfo = this.objectInfo.data.recordTypeInfos;
        var uiCombobox = [];
        console.log("recordtype" + recordtypeinfo);
        for(var eachRecordtype in  recordtypeinfo)//this is to match structure of lightning combo box
          uiCombobox.push({ label: recordtypeinfo[eachRecordtype].name, value: recordtypeinfo[eachRecordtype].name })
        console.log('uiCombobox' + JSON.stringify(uiCombobox));
      return uiCombobox;

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">