• Kanwalpreet Singh
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi,

How i can check on controller if page is opened using 'Salesforce Classic' or 'Salesforce lightning' UI(for winter 16 release).

Thanks,
Kanwalpreet Singh
What are the minimum required permissions to query 'Organisation' object using apex. Is it available to all internal users by default.
When will be Winter 16 release notes available
Hi,

How i can check on controller if page is opened using 'Salesforce Classic' or 'Salesforce lightning' UI(for winter 16 release).

Thanks,
Kanwalpreet Singh
Hi,

!)If OWD access level is public for Object, there is a client requirement to restrict few users not to see records.  so how we can restrict?

2)if OWD access level is private for Object, there is a client requirement to restrict few users not to see records.  so how we can restrict?

please help me with solution for above two scenarios....

Thanks in advance
Thulasi
I create some reports in my org . 
I wrote a batch that retrieves accounts  from reports using Report Apex API and does some calculations.
My Reports have filters , when  i run  batch from user context clicking on a link that i created  , i get right results , only filtered records but when batch runs  in system context as scheduledbatch somehow  a lot of records are retrieved as if filters have no affect , does someone have  an idea how i can get only filtered results  when batch runs from system context
results = Reports.ReportManager.runReport(currentHeatScoreSet.Report_Id__c, true);
	  	System.debug(' HeatScoreCalc=>start ' + results);
	 	Reports.ReportDescribeResult describe = Reports.ReportManager.describeReport(currentHeatScoreSet.Report_Id__c);
        Reports.ReportMetadata reportMd = describe.getReportMetadata();
        Reports.StandardDateFilter standardDateFilter = reportMd.getStandardDateFilter();
        Reports.ReportFactWithDetails factDetails;
        try{
         	factDetails =(Reports.ReportFactWithDetails) results.getFactMap().get('T!T');
        }catch(Exception exp){
             exp.setMessage('HeatScoreCalc=> HeatScoreCalc:error retrieving fact map\n' +exp.getMessage());
            Log.writeError(exp, true);
       
        }
        
        
        System.debug('fact details ' + factDetails);
        Reports.ReportMetadata metaData;
        try{
        	metaData= results.getReportMetadata();
        }catch(Exception exp){
            exp.setMessage('HeatScoreCalc=> HeatScoreCalc:error retrieving metadate\n' +exp.getMessage());
            Log.writeError(exp, true);
        }    
        
        
        System.debug('HeatScoreCalc=>metadata '+ metaData);
         LIST<String> detailsColumnsAPINames = metaData.getDetailColumns();
        Integer index=0;
      	Boolean found = false;
        for(Integer i=0;i<detailsColumnsAPINames.size();i++){
          
            if(detailsColumnsAPINames.get(i).equals( currentHeatScoreSet.target_Id_field__c)){
                found= true;
                break;
            }
            
            index++;
        }
        System.debug('HeatScoreCalc=> column number ' + index);
        objectIds = new List<String>();
        if(found==true){
            for(Reports.ReportDetailRow row: factDetails.getRows()){
                List<Reports.ReportDataCell> cells =row.getDataCells();
                if(cells!=null && cells.size()!=0){
                    Reports.ReportDataCell cell = cells.get(index);
                    objectIds.add((String) cell.getValue());
                }
                
            }
        }else{
          	 HeatScoreException exp = new HeatScoreException();
             exp.setMessage('HeatScoreCalc=>HeatScoreCalc:Cant find in the report with id  ' +currentHeatScoreSet.Report_Id__c+' field id name ' + currentHeatScoreSet.target_Id_field__c);
            Log.writeError(exp, true);
            System.debug('HeatScoreCalc=>unrecognizable field  ' + found);
        }