Skip to main content
added 35 characters in body
Source Link
Akash
  • 3
  • 2
  • 5

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc';

import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked - used custom look logic to get ID
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc';

import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc';

import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked - used custom look logic to get ID
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}
added 2 characters in body
Source Link
Akash
  • 3
  • 2
  • 5

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc'; 

import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc';
import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc'; 

import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}
added 18 characters in body
Source Link
David Reed
  • 93.7k
  • 14
  • 90
  • 166

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper { @AuraEnabled
public static string inserRcd(BM_Service__c serviceObj){
insert serviceObj;
} }

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc'; import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c'; import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) {

@api serviceRcd = SERVICE_OBJECT;
@api selectedAccRecordId;
@api serviceName;

import { LightningElement,wire,api } from 'lwc';
import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}

}

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper { @AuraEnabled
public static string inserRcd(BM_Service__c serviceObj){
insert serviceObj;
} }


serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc'; import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c'; import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) {

@api serviceRcd = SERVICE_OBJECT;
@api selectedAccRecordId;
@api serviceName;

serviceNameChngHandler(event){
    //Entered Service Name
    this.serviceName = event.target.value;
}

selActRcdHandler(event) {
    //account record selected ID value picked
    this.selectedRecordId = event.detail;        
}

//Save Button action
saveActionHandler(){
    //Calling apex method with 2 parameters in object BM_Service__c
    
    this.serviceRcd.Name this.serviceName;  //Name of Service Record
    this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
    
    insertServiceRcd({
       serviceObj : this.serviceRcd

    }).then(result=>{
        alert('Success::');
    }).catch((error)=>{
        alert('Error:::');
    });
}

}

While creating a custom object record using LWC with two values Name and Customer (look up to Account), encountering below error:

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Customer: value not of required type: [0011H000023s57sQAA]: [Customer__c]


BM_Servicehelper.cls

public with sharing class BM_Servicehelper {
@AuraEnabled    
public static string inserRcd(BM_Service__c serviceObj){        
insert serviceObj;  
}
}

serviceUIActLwc.js

import { LightningElement,wire,api } from 'lwc';
import SERVICE_OBJECT from '@salesforce/schema/BM_Service__c';
import insertServiceRcd from '@salesforce/apex/BM_Servicehelper.inserRcd';

export default class ServiceUIActLwc extends NavigationMixin(LightningElement) { 

@api serviceRcd = SERVICE_OBJECT;   
@api selectedAccRecordId;   
@api serviceName;

    serviceNameChngHandler(event){
        //Entered Service Name
        this.serviceName = event.target.value;
    }

    selActRcdHandler(event) {
        //account record selected ID value picked
        this.selectedRecordId = event.detail;        
    }
    
    //Save Button action
    saveActionHandler(){
        //Calling apex method with 2 parameters in object BM_Service__c
        
        this.serviceRcd.Name this.serviceName;  //Name of Service Record
        this.serviceRcd.Customer__c = this.selectedAccRecordId; // Lookup field to Account
        
        insertServiceRcd({
           serviceObj : this.serviceRcd

        }).then(result=>{
            alert('Success::');
        }).catch((error)=>{
            alert('Error:::');
        });
    }

}
deleted 8 characters in body
Source Link
Akash
  • 3
  • 2
  • 5
Loading
deleted 154 characters in body
Source Link
Akash
  • 3
  • 2
  • 5
Loading
Source Link
Akash
  • 3
  • 2
  • 5
Loading