• Sochy_Eisenberg
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hello Trailblazers, 
I need some help. 
This code belo is fairly basic since I'm new dev. I have a VF page with a Select Option that I'm trying to save the value to a String called selectedValue. The controller is fine, but I can't get the VF page to save. The error I'm getting is "Unknown propertySchemaController.selectedValue'"

Here is the VF Page:
<apex:page controller="SchemaController">
    <apex:form >
    	<apex:pageBlock >
            <apex:selectList value="{!selectedValue}" size="1" >Select an Object to get details: 
            	<apex:selectOptions value="{!objectList}"/>
            </apex:selectList>
        </apex:pageBlock>
         
    </apex:form>
</apex:page>

And the Cotroller:
public class SchemaController {
    
    String selectedValue;
    
    public  List<SelectOption>  getObjectList() {
        
        
            List<SelectOption> options = new List<SelectOption>();                          
            Map<String, Schema.SObjectType> objectList = Schema.getGlobalDescribe();
                for(String s : objectList.keySet()) {
                    options.add(new SelectOption (s, s));
                }
            
        
            return options;
    }

    public void setSelectedValue(String selectedValue) {
        this.selectedValue = selectedValue;
    }
}


Thank you!

I have a Schedulable class that is designed to run every hour and notify the Admin of any apex job errors so they can be addressed. I am unsure how to write the unit test since the AsyncApexJob object is read-only. Is there some kind of mockup I would use in order to get AsyncApexJob records in? Below is the my code so far. 
 
public class JobMonitorSchedulable implements Schedulable {
    
    public void execute(SchedulableContext ctx) {
     	
        List<String> emailTo = new List<String>();
        for(String email : Label.Apex_Job_Monitor_Recipient.Split(',')) {
            emailTo.add(email);
        }
        
        String subject       	= 'Apex job Failures';
        String emailBody 		= '';
        DateTime interval = DateTime.now().addMinutes(-65);
        
        // Query the failed jobs
        List<AsyncApexJob> failedJobs = [SELECT ApexClass.Name, Status, NumberOfErrors, JobItemsProcessed,
                                        TotalJobItems, CreatedBy.Name, ExtendedStatus, CreatedDate
                                        FROM AsyncApexJob WHERE ExtendedStatus != null AND CreatedDate > :interval];
        // Add columns to csv file header
        String csvHeader = 'Created By, Apex Class, Created Date, Status, Number of Errors, Total Job Items, Extended Status \n';
		String finalstr = csvHeader;            
        // Add failed job info to string
        if(!failedJobs.isEmpty()) {
            for(AsyncApexJob j : failedJobs) {
                emailBody += (j.CreatedBy.Name + ' ' + j.ApexClass.Name + ' ' + j.CreatedDate.format() + ' ' + 
                              j.Status + ' '+ j.NumberOfErrors + '/' + 
                              j.TotalJobItems + ' ' + j.ExtendedStatus + + '\n');
                
                String recordString = j.CreatedBy.Name + ',' + j.ApexClass.Name + ',' + j.CreatedDate.format() + ',' + 
                              j.Status + ','+ j.NumberOfErrors + ',' + 
                              j.TotalJobItems + ',' + j.ExtendedStatus + '\n';
                finalStr = finalStr + recordString;
            }
            
            // Add csv attachment
            Messaging.EmailFileAttachment csvAttc = new Messaging.EmailFileAttachment();
            blob csvBlob   = Blob.valueOf(finalstr);
            string csvname = 'Failed Apex Jobs.csv';
            csvAttc.setFileName(csvname);
            csvAttc.setBody(csvBlob);
            
            // Send email with failed jobs
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setToAddresses(emailTo);
            mail.setSubject(subject);
            mail.setPlainTextBody(emailBody);
            mail.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc});
            
            Messaging.SendEmailResult[] results = Messaging.sendEmail(
                new Messaging.SingleEmailMessage[] { mail });
        }
    }

}

 
Hi guys,

I'm trying to filter a SOQL query on the LoginHistory object using the Application field. Apprrently, this is not possible since 'Application' is not filterable (curious as to why that is.) I'm wondering if there is any workaround to this limitation, assuming I need to filter the information in Application to achieve my goal.

Thanks!
Hi guys,

I'm trying to filter a SOQL query on the LoginHistory object using the Application field. Apprrently, this is not possible since 'Application' is not filterable (curious as to why that is.) I'm wondering if there is any workaround to this limitation, assuming I need to filter the information in Application to achieve my goal.

Thanks!
Hi, I have 2 custom objects...

1. Renewal (Renewal__c)
2. Module (Module__c)

I have used Lookup relationship between the 2 objects - Module Custom object is listed as the Related lists under Renewal object. I'm unable to use Master Detail relationship as i do not want the Master record to be deleted when a child is deleted.

Module custom object (Module__c) has a field called Price_with_Tax__c and
Renewal object has a field called Total_Amount_Modules__c.

Module will have multiple records added. I need to sum the total of Price_with_Tax__c field and store it in the Total_Amount_Modules__c field.

I found few samples for Opportunity object. I tried but couldnt get it to work. Can anyone help me with a sample trigger for this case ?

Thank you
  • April 14, 2017
  • Like
  • 0
My homepage has standard Lightning Component Report Charts. I do not want my users to have to press refresh reports by pressing a refresh button.

I want those report charts to auto-refresh each time the page is loaded.

Is this possible declaritively? Does it require code?

Thank you.