function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fiona gentryfiona gentry 

lightning Error Case: id value of incorrect type: at Edit Case Type

Hi Gurus,

I am trying to edit an existing ERT case type which is a child to Case object by overriding standard EDIT buttin in ERT case record ,here is error 

User-added imageI am using use Philippe Ozil's ready component (https://github.com/pozil/sfdc-ui-lookup) for the lookup/autocomplete thing. copied save LookupSearchResult class, the whole aura component and 2 aura events in my org ..here is controller apex
public with sharing class ERT_MultiLevelSelectEdit {
    @AuraEnabled(cacheable=true)
    public static List<LookupSearchResult> search(String searchTerm, List<String> selectedIds){
        if(String.isBlank(searchTerm) || searchTerm.length() < 2){
            return null;
        }
        String t = '%' + searchTerm + '%'; 
        
        List<Case_Type_Data__c> records =  [FIND :('*' + searchTerm + '*') IN ALL FIELDS 
        RETURNING Case_Type_Data__c(Id, Name, Level_1__c, Level_2__c, Level_3__c)][0];
        
     
        
        List<LookupSearchResult> results = new List<LookupSearchResult>();
        for(Case_Type_Data__c ctd : records){
            results.add(new LookupSearchResult(ctd.Id, 'Case_Type_Data__c', 'standard:case_wrap_up', ctd.Name,
                String.join(new List<String>{ctd.Level_1__c , ctd.Level_2__c, ctd.Level_3__c}, '; ')
            ));
        }
        return results;
    } 
}

Here is cmp
<aura:component implements="force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction,lightning:actionOverride" access="global" controller="ERT_MultiLevelSelectEdit">
        
    <aura:attribute access="public" type="List" name="selection" default="[]"/>
    <aura:attribute access="public" type="List" name="errors" default="[]"/>

    <lightning:card title="Edit Case Type">

        <lightning:recordEditForm aura:id="myForm" objectApiName="ERT_Case_Type__c" onsubmit="{!c.onSubmit}" onsuccess="{!c.onSuccess}">
        <lightning:messages />
        <c:Lookup selection="{!v.selection}" onSearch="{!c.lookupSearch}" onSelection="{!c.useSelected}" errors="{!v.errors}" label="Search" placeholder="Search Case Types Data"/>
        <lightning:inputField aura:id="Level_1__c" fieldName="Level_1__c" />
        <lightning:inputField aura:id="Level_2__c" fieldName="Level_2__c" />
        <lightning:inputField aura:id="Level_3__c" fieldName="Level_3__c" />
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="save" label="Save" />
    </lightning:recordEditForm>
    </lightning:card>
</aura:component>

Any resolution why I am getting this Case: id value of incorrect type: a3k2F0000007GUpQAMerror ""

Regards,
Fiona
 
Best Answer chosen by fiona gentry
ShirishaShirisha (Salesforce Developers) 
Hi Fiona,

Greetings!

This error occurs,if you have defined the list of type as one and the returned value is of type some other.I would suggest you to check the list which is being returned from the SOSL query.

Reference:https://salesforce.stackexchange.com/questions/62974/error-compile-error-invalid-bind-expression-type-of-sobjectaccountshare-does

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri