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
GauriiGaurii 

I am writing the controller for lightning component which query records on some condition and update the owner field with created by user can some body please help

public class Code123Controller {
    public static boolean setValue{get; set;}
    @AuraEnabled
    public static String getUserList1() {
        String usrid = UserInfo.getUserId();
        
        return usrid;
    }
    
    @AuraEnabled
    public static boolean getCodeDetails(string userid,string Code ) {
        Code__c CodeList;
       
        //String usrid = UserInfo.getUserId() ; 
        try{
            CodeList = [SELECT Id,Active__c,Code__c FROM Code__c 
                            where Code__c=:Code AND Active__c = True];
            
               Code__c updateOwner = new Code__c();
                if(CodeList.Code__c == Code){
                    
                    overCodeList.OwnerId = CreatedbyId;
                    update CodeList;
                    setValue = true;
                }  
            
        }Catch(Exception e){
            setValue = false;  
            system.debug(e);
        }
        return setValue;
    }          
Footprints on the MoonFootprints on the Moon
Can you share what error is being shown?
GauriiGaurii
there is no error as such but it is not working