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
Nitin tronixdevNitin tronixdev 

Problem Facing In Lightining Page Controller


@AuraEnabled
    public static void saveAll(String data  ){
         System.debug('1 '+ data);
data = data.removeStart('[');
      data = data.removeEnd(']');
        String [] obj = new String [] {};
            obj = data.split(',');
        System.debug('2 '+obj);
        for(String str :obj){
            System.debug('3'+str);
            
          Check_List__c c =  [SELECT Work__c,Start_Time__c,End_Time__c, Name,Duration__c,Company_Name__c,Site_Name__c,Shift__c from Check_List__c where Id=:str ];
           System.debug([SELECT Work__c,Start_Time__c,End_Time__c, Name,Duration__c,Company_Name__c,Site_Name__c,Shift__c from Check_List__c where Id=:str]);
                    
        }

In the above code when i try to pull data from from table with where condition of str (str holds the id of the record), but i m getting tmpvar1 in System.debug , it returns me no rows...

here is the debug logs :-


Nitin tronixdev Date 09/06/2015 11:47:32 BST
Status List has no rows for assignment to SObject Application Browser
Request Type Application Operation /aura
Duration (ms) 75 Log Size (bytes) 3,832
Log
34.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO 11:47:32.062 (62569498)|EXECUTION_STARTED 11:47:32.062 (62596378)|CODE_UNIT_STARTED|[EXTERNAL]|aura 11:47:32.063 (63248020)|CODE_UNIT_STARTED|[EXTERNAL]|01p24000006DC6u|View_lgth.saveAll 11:47:32.063 (63358409)|METHOD_ENTRY|[1]|01p24000006DC6u|View_lgth.View_lgth() 11:47:32.063 (63370220)|METHOD_EXIT|[1]|View_lgth 11:47:32.063 (63383689)|SYSTEM_MODE_ENTER|false 11:47:32.063 (63529624)|SYSTEM_METHOD_ENTRY|[35]|System.debug(ANY) 11:47:32.063 (63565294)|USER_DEBUG|[35]|DEBUG|1 ["a0R24000001xsyXEAQ","a0R24000001xsyYEAQ","a0R24000001xsyXEAQ","a0R24000001xsyYEAQ"] 11:47:32.063 (63574663)|SYSTEM_METHOD_EXIT|[35]|System.debug(ANY) 11:47:32.063 (63598557)|SYSTEM_METHOD_ENTRY|[36]|String.removeStart(String) 11:47:32.063 (63622057)|SYSTEM_METHOD_EXIT|[36]|String.removeStart(String) 11:47:32.063 (63638086)|SYSTEM_METHOD_ENTRY|[37]|String.removeEnd(String) 11:47:32.063 (63658134)|SYSTEM_METHOD_EXIT|[37]|String.removeEnd(String) 11:47:32.063 (63683915)|SYSTEM_CONSTRUCTOR_ENTRY|[38]|<init>() 11:47:32.063 (63720358)|SYSTEM_CONSTRUCTOR_EXIT|[38]|<init>() 11:47:32.063 (63741555)|SYSTEM_METHOD_ENTRY|[39]|String.split(String) 11:47:32.063 (63788160)|SYSTEM_METHOD_EXIT|[39]|String.split(String) 11:47:32.063 (63850439)|SYSTEM_METHOD_ENTRY|[40]|String.valueOf(Object) 11:47:32.063 (63884722)|SYSTEM_METHOD_EXIT|[40]|String.valueOf(Object) 11:47:32.063 (63897722)|SYSTEM_METHOD_ENTRY|[40]|System.debug(ANY) 11:47:32.063 (63903924)|USER_DEBUG|[40]|DEBUG|2 ("a0R24000001xsyXEAQ", "a0R24000001xsyYEAQ", "a0R24000001xsyXEAQ", "a0R24000001xsyYEAQ") 11:47:32.063 (63909159)|SYSTEM_METHOD_EXIT|[40]|System.debug(ANY) 11:47:32.063 (63919437)|SYSTEM_METHOD_ENTRY|[41]|List<String>.iterator() 11:47:32.063 (63966105)|SYSTEM_METHOD_EXIT|[41]|List<String>.iterator() 11:47:32.063 (63980409)|SYSTEM_METHOD_ENTRY|[41]|system.ListIterator.hasNext() 11:47:32.064 (64014232)|SYSTEM_METHOD_EXIT|[41]|system.ListIterator.hasNext() 11:47:32.064 (64045265)|SYSTEM_METHOD_ENTRY|[42]|System.debug(ANY) 11:47:32.064 (64059860)|USER_DEBUG|[42]|DEBUG|3 "a0R24000001xsyXEAQ" 11:47:32.064 (64065117)|SYSTEM_METHOD_EXIT|[42]|System.debug(ANY) 11:47:32.064 (64081886)|SYSTEM_METHOD_ENTRY|[43]|String.valueOf(Object) 11:47:32.064 (64103595)|SYSTEM_METHOD_EXIT|[43]|String.valueOf(Object) 11:47:32.064 (64117159)|SYSTEM_METHOD_ENTRY|[44]|System.debug(ANY) 11:47:32.064 (64129174)|USER_DEBUG|[44]|DEBUG|4 "a0R24000001xsyXEAQ" 11:47:32.064 (64134047)|SYSTEM_METHOD_EXIT|[44]|System.debug(ANY) 11:47:32.065 (65439377)|SOQL_EXECUTE_BEGIN|[45]|Aggregations:0|SELECT Work__c, Start_Time__c, End_Time__c, Name, Duration__c, Company_Name__c, Site_Name__c, Shift__c FROM Check_List__c WHERE Id = :tmpVar1 11:47:32.068 (68530502)|SOQL_EXECUTE_END|[45]|Rows:0 11:47:32.068 (68766465)|FATAL_ERROR|System.QueryException: List has no rows for assignment to SObject Class.View_lgth.saveAll: line 45, column 1 11:47:32.068 (68780563)|FATAL_ERROR|System.QueryException: List has no rows for assignment to SObject Class.View_lgth.saveAll: line 45, column 1 11:47:32.068 (68795368)|CUMULATIVE_LIMIT_USAGE 11:47:32.068 (68795368)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 11:47:32.068 (68795368)|CUMULATIVE_LIMIT_USAGE_END 11:47:32.068 (68842777)|CODE_UNIT_FINISHED|View_lgth.saveAll


or is there any other way to do this in lighting controller....



Or Is there any other way to develop VF page for both MO. and Web??
bob_buzzardbob_buzzard
The debug suggests the ID is surrounded by double quotes - try stripping those out.
Nitin tronixdevNitin tronixdev

Will you please be more specific , what should i do with those IDS ? 

bob_buzzardbob_buzzard
The debug log shows the id as surrounded by double quote marks - I would remove those and see if it helps.

As you are treating them as strings, you can do str=str.replace('"', '') - i.e. replace the double quote with an empty string.