Suitescript2 Transform Opportunity to Estimate Failing

I have a method that transforms one record to another. When transforming an Opportunity to a Sales Order it works perfectly. However, when I try to convert an Opportunity to an Estimate, I get an Unexpected Error upon saving the new record. This is the basics on what I have setup.

Function Call

if(data.estimate) {
    log.debug("Creating Estimate")
    estimateid = transformTransactionRecord(
        record.Type.OPPORTUNITY, opportunityid,
        record.Type.ESTIMATE, leadid,
        data.estimate, data.opportunity.salesrep
    );
}

Function

function transformTransactionRecord(fromtype, fromid, totype, leadid, data, salesrep) {
    var recordid = transformRecordAndSetNewValues({
        from : {
            type : fromtype, 
            id : fromid
        },
        to : {
            type : totype
        },
        values : data,
        entity : leadid,
        ignoreMandatoryFields : false,
    });
    record.submitFields({
        type : totype,
        id : recordid,
        values : {
            salesrep : salesrep
        }
    });
    //replace all lines
    replaceAllItemLines(recordid, data.lines);
    return recordid;
}

function transformRecordAndSetNewValues(data){
    var objRecord = record.transform({
        fromType : data.from.type,
        fromId : data.from.id,
        toType : data.to.type,
        isDynamic : true,
    });
    objRecord.setValue({
        fieldId : "entity",
        value : data.entity
    });
    delete data.values.shippingaddress;
    setRecordValues(objRecord, data.values);
    //===== FAILS HERE ON SAVE =====
    var recId = objRecord.save({
        ignoreMandatoryFields : data.ignoreMandatoryFields
    });
    setRecordForm({
        recordid : recId,
        form : data.values.customform,
        type : data.to.type
    });
    return recId;
}

function setRecordValues(objRecord, values)
{
    var discount = {
        hasDiscount : false
    }
    //Loop Fields And Add Values
    for(var key in values){
        var value = values[key];
        if(key == "customform") continue;
        if(key == "shippingaddress" || key === "billingaddress"){
            createAddress(objRecord, key, values)
            continue;
        }
        if(key == "discountitem" || key == "lines" || key == "formtype") continue;
        if(key == "discountrate") {
            objRecord.setValue({
                fieldId : 'discountitem',
                value : values.discountitem
            });
            objRecord.setValue({
                fieldId : "discountrate",
                value : value
            });
            continue;
        }
        //if(key === "type") continue;
        
        value = testForBooleanAndConvertToBoolean(value);
        value = testForDateAndConvertToDate(value, key);
        log.debug("Setting " + key, value)
        objRecord.setValue({
            fieldId : key,
            value : value
        });
    }
}

The Estimate Data Is As Follows

{
    "lines": {
        "0": {
            "item": {
                "id": "1234",
                "sku": "REDACTED",
                "pricelevels": {
                    "1": "162.72727",
                    "6": "122.04545",
                    "7": "81.36364",
                    "9": "154.59",
                    "10": "146.45",
                    "11": "138.32",
                    "12": "130.18"
                },
                "taxcode": {
                    "text": "GST",
                    "value": "7"
                },
                "taxrate": "10.00",
                "displayname": "REDACTED",
                "description": "REDACTED",
                "type": {
                    "text": "Assembly/Bill of Materials",
                    "value": "Assembly"
                },
                "model": "1",
                "weight": "2.1",
                "serviceduration": "15"
            },
            "quantity": "1",
            "pricelevel": {
                "value": "1",
                "text": "BASE PRICE"
            },
            "rate": "162.72727",
            "amount": "162.73",
            "taxcode": "GST",
            "taxrate1": "10.00",
            "tax1amt": "16.27",
            "grossamount": "179.00"
        }
    },
    "customform": "147",
    "formtype": "true",
    "department": "7",
    "location": "1",
    "terms": "12",
    "discountrate": "",
    "discountitem": "3676",
    "discountapproved": "false"
}