• kieran.osullivan
  • NEWBIE
  • 125 Points
  • Member since 2012

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 13
    Replies
What happens if a user executes a schema.describe.getGlobal and they do not have access to certain objects.
What I really want to know here is what level of access do users have to have to use this method.
 

Discrepancy between Code Coverage in Sandbox and Production

 

In brief my question is When I am told that the deployment has failed because there is only 73% code coverage how do I find which code is not covered.  Do not say look at the classes because they do not show this info.  The attempt to deploy may run all the tests but I can't find where it puts the results/

 

When I disable a trigger and deploy it, it fails in production because some test is less than 75%.

 

However the trigger uses only one class and that class has its own test data and method.

When I run the tests in the sandbox they give code coverage of 80% for this class.

When the trigger is enabled it deploys every time.

I need to turn this trigger off as it is used to generate code numbers and they are not needed when the data is being imported.

 

I have a trigger which I want to disable (it generates data for one field and the import I am doing doesn't need that data generated)

 

If the trigger is active I can deploy it.  If the trigger is inactive I can't deploy it.

 

WHAT THE HELL IS THIS ABOUT?

 

I have another trigger which I can deploy when it is inactive.

I have a trigger which creates a new opportunity when an asset has a status of Paid and has an expiry date.

This code works fine when records are input using the web interface but when I tried to import 5,000 records using the DataLoader only 23 records imported and the rest were rejected because of SOQL limits on this trigger.

 

I need to know is my code very innefficient?

I thaught I had taken care to ensure that there was as few inserts and updates as possible.

 

Strangely when I re-imported the records they imported without any problems except MY TRIGGER SEEMS TO HAVE BEEN IGNORED SALESFORCE DID NOT RUN IT.  IS THAT POSSIBLE?

 

 

trigger CreateOpportunities on Asset (after update, after insert) {
    Boolean NewOpp = false;
    List <Opportunity> OppToUpdate = new List <Opportunity> {};
    List <Opportunity> OppToInsert = new List <Opportunity> {};
    for(Asset aset: Trigger.new){
        if (aset.Status == 'Paid'){
            Opportunity opp = null;
            try {
                opp =  [select Name,ACCOUNTID,CurrencyIsoCode,CLOSEDATE,Asset__c from Opportunity where asset__c =: aset.ID limit 1];
            } catch (Exception e){}
            if (opp == null) {
                opp = new Opportunity();
                NewOpp = true;
            }
            opp.ACCOUNTID = aset.AccountID;
            opp.Name = 'Automated Opportunity for ' + aset.Name;
            opp.CurrencyIsoCode = aset.CurrencyIsoCode;
            opp.CLOSEDATE = aset.Maintenance_Expires__c;
            opp.Asset__c = aset.ID;
            if (NewOpp){
                opp.StageName = 'Work in Progress';
                OppToInsert.add(opp);
                // insert opp;
            } else {OppToUpdate.add(opp);}
            NewOpp = false;
        }
    }

    if (OppToUpdate.size() > 0) {update OppToUpdate;}
    if (OppToInsert.size() > 0) {insert OppToInsert;}
}

I am trying to re-create the Products page using VFP and it all works except the Default Revenue Schedule.

I looked at the Page Layout for this and I can't figure out where this section comes from or how to re-create it in VFP.  The only field that relates to revenue is called CanUseRevenueSchedule.

 

Can anyone tell me how this Default Revenue Schedule can be re-produced in VFP?

Thansk

I want a Visual Force Page to send an e-mail when it is opened and I tried to do this with an extension but it did not work.

Can an extension to a VFP which uses a standard controller send an e-mail?

I have tried the following.

1. The debug logs appear to show the messages being sent.

2. My triggers send e-mails to the same address so there is nothing wrong there.

3. I have sent messages to different servers so it is not the server.

4. The extension code executes without errors.

5. The e-mail addresses are correct.

My code is below, any suggestions would be grate thanks?

Visual Force Page
<apex:page sidebar="false" showHeader="false" extensions="EmailPDFController2" standardController="mycompany_Invoice__c">
<p>Sending Email</p>
</apex:page>

APEX Class
public class EmailPDFController2 {
    public EmailPDFController2 (ApexPages.StandardController controller){    
         try {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{'test2@test2.com'};
            String[] CopyToAddresses = new String[]{'test@test1.com','test3@test3.com'};
            mail.setToAddresses(toAddresses);
            mail.setCcAddresses(CopyToAddresses);
            String msg = 'Hellow';            
            mail.setPlainTextBody(msg);
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
        } catch (Exception e){}
    }
}


Log Entrhy

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
11:30:10.071 (71679000)|EXECUTION_STARTED
11:30:10.071 (71737000)|CODE_UNIT_STARTED|[EXTERNAL]|066U0000000GXQs|VF: /apex/mycompanyInvoicePDF
11:30:10.074 (74704000)|CODE_UNIT_STARTED|[EXTERNAL]|01pU00000012Pwn|EmailPDFController2 <init>
11:30:10.074 (74722000)|SYSTEM_MODE_ENTER|true
11:30:10.075 (75730000)|METHOD_ENTRY|[1]|01pU00000012Pwn|EmailPDFController2.EmailPDFController2()
11:30:10.075 (75828000)|METHOD_EXIT|[1]|EmailPDFController2
11:30:10.076 (76837000)|SYSTEM_CONSTRUCTOR_ENTRY|[5]|<init>()
11:30:10.076 (76875000)|SYSTEM_CONSTRUCTOR_EXIT|[5]|<init>()
11:30:10.076 (76910000)|SYSTEM_METHOD_ENTRY|[5]|LIST<String>.add(Object)
11:30:10.076 (76930000)|SYSTEM_METHOD_EXIT|[5]|LIST<String>.add(Object)
11:30:10.076 (76944000)|SYSTEM_CONSTRUCTOR_ENTRY|[6]|<init>()
11:30:10.076 (76965000)|SYSTEM_CONSTRUCTOR_EXIT|[6]|<init>()
11:30:10.076 (76985000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77000000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77018000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77032000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77270000)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
11:30:10.077 (77302000)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
11:30:10.077 (77324000)|SYSTEM_METHOD_ENTRY|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77342000)|SYSTEM_METHOD_EXIT|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77389000)|SYSTEM_METHOD_ENTRY|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.085 (85895000)|EMAIL_QUEUE|[11]|bccSender: false, saveAsActivity: true, useSignature: true, toAddresses: [test2@test2.com], ccAddresses: [test@test1.com, test3@test3.com], plainTextBody: Hellow,
11:30:10.086 (86044000)|SYSTEM_METHOD_EXIT|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.086 (86068000)|CODE_UNIT_FINISHED|EmailPDFController2 <init>
11:30:10.649 (89096000)|CUMULATIVE_LIMIT_USAGE
11:30:10.649|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 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
  Number of script statements: 8 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 1 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

11:30:10.649|CUMULATIVE_LIMIT_USAGE_END

11:30:10.089 (89131000)|CODE_UNIT_FINISHED|VF: /apex/mycompanyInvoicePDF
11:30:10.089 (89143000)|EXECUTION_FINISHED

I want a Visual Force Page to send an e-mail when it is opened and I tried to do this with an extension but it did not work.

 

Can an extension to a VFP which uses a standard controller send an e-mail?

 

I have tried the following.

 

1. The debug logs appear to show the messages being sent.

2. My triggers send e-mails to the same address so there is nothing wrong there.

3. I have sent messages to different servers so it is not the server.

4. The extension code executes without errors.

5. The e-mail addresses are correct.

 

My code is below, any suggestions would be grate thanks?

 

Visual Force Page
<apex:page sidebar="false" showHeader="false" extensions="EmailPDFController2" standardController="mycompany_Invoice__c">
<p>Sending Email</p>
</apex:page>

APEX Class
public class EmailPDFController2 {
    public EmailPDFController2 (ApexPages.StandardController controller){    
         try {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{'test2@test2.com'};
            String[] CopyToAddresses = new String[]{'test@test1.com','test3@test3.com'};
            mail.setToAddresses(toAddresses);
            mail.setCcAddresses(CopyToAddresses);
            String msg = 'Hellow';            
            mail.setPlainTextBody(msg);
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
        } catch (Exception e){}
    }
}


Log Entrhy

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
11:30:10.071 (71679000)|EXECUTION_STARTED
11:30:10.071 (71737000)|CODE_UNIT_STARTED|[EXTERNAL]|066U0000000GXQs|VF: /apex/mycompanyInvoicePDF
11:30:10.074 (74704000)|CODE_UNIT_STARTED|[EXTERNAL]|01pU00000012Pwn|EmailPDFController2 <init>
11:30:10.074 (74722000)|SYSTEM_MODE_ENTER|true
11:30:10.075 (75730000)|METHOD_ENTRY|[1]|01pU00000012Pwn|EmailPDFController2.EmailPDFController2()
11:30:10.075 (75828000)|METHOD_EXIT|[1]|EmailPDFController2
11:30:10.076 (76837000)|SYSTEM_CONSTRUCTOR_ENTRY|[5]|<init>()
11:30:10.076 (76875000)|SYSTEM_CONSTRUCTOR_EXIT|[5]|<init>()
11:30:10.076 (76910000)|SYSTEM_METHOD_ENTRY|[5]|LIST<String>.add(Object)
11:30:10.076 (76930000)|SYSTEM_METHOD_EXIT|[5]|LIST<String>.add(Object)
11:30:10.076 (76944000)|SYSTEM_CONSTRUCTOR_ENTRY|[6]|<init>()
11:30:10.076 (76965000)|SYSTEM_CONSTRUCTOR_EXIT|[6]|<init>()
11:30:10.076 (76985000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77000000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77018000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77032000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77270000)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
11:30:10.077 (77302000)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
11:30:10.077 (77324000)|SYSTEM_METHOD_ENTRY|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77342000)|SYSTEM_METHOD_EXIT|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77389000)|SYSTEM_METHOD_ENTRY|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.085 (85895000)|EMAIL_QUEUE|[11]|bccSender: false, saveAsActivity: true, useSignature: true, toAddresses: [test2@test2.com], ccAddresses: [test@test1.com, test3@test3.com], plainTextBody: Hellow,
11:30:10.086 (86044000)|SYSTEM_METHOD_EXIT|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.086 (86068000)|CODE_UNIT_FINISHED|EmailPDFController2 <init>
11:30:10.649 (89096000)|CUMULATIVE_LIMIT_USAGE
11:30:10.649|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 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
  Number of script statements: 8 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 1 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

11:30:10.649|CUMULATIVE_LIMIT_USAGE_END

11:30:10.089 (89131000)|CODE_UNIT_FINISHED|VF: /apex/mycompanyInvoicePDF
11:30:10.089 (89143000)|EXECUTION_FINISHED

 

 

I have a page which is extended by the "EmailPDFController" class as seen bleow.

The problem is that the getContent call cuases an error and I have no idea why.

 

What I am trying to do is create a pdf and mail it to myself.  Creating the pdf works fine but sending it to myself is not working.

 

See code below.  Try and catch blocks are deliberatly commented out.

 

public with sharing class EmailPDFController {
    public EmailPDFController (ApexPages.StandardController controller){    
        // try {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{'firstname.lastname@company.domain'};
            String[] CopyToAddresses = new String[]{'tname@company.domain','firstname.lastname@company.domain'};
            mail.setToAddresses(toAddresses);
            // mail.setCcAddresses(CopyToAddresses);
            mail.setBccAddresses(CopyToAddresses);
            mail.setReplyTo('x@y.com');        
            mail.setSenderDisplayName('x y');
            mail.setSubject('PDF Invoise ');
            // mail.setBccSender(false);
            mail.setUseSignature(false);
            String msg = '<p><b>Hellow</b></p>';


            PageReference congratsPage = ApexPages.currentPage();
            Blob b = congratsPage.getContent();
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('MyPDF.pdf'); // neat - set name of PDF
            efa.setBody(b); //attach the PDF
            mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            
            mail.setHtmlBody(msg);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});
//        } catch (Exception e){}
    }
    
    @IsTest(SeeAllData=true) public static void testEmailPDFController() {
        ApexPages.StandardController c;
        EmailPDFController EPDFC = new EmailPDFController(c);
        try {
            // System.assertEquals(EPDFC.EmailPDFController(),null);    
        }
        catch (Exception e){}
    }
}

I am looking at site.com and while it all looks very good I am left with a simple question.  Can I create visual force pages with it and import them into my site created in salesforce "propper"?

If not then what is site.com all about?

 

All the tutorials tell me hwo to create pages with site.com but I don't see how to integrate my salesforce "propper" sites and objects with this tool.

 

I am trying to insert assets using the data loader but it does not give me the assets object in the list of objects.  Also I can't find a "New" assets button when I go into Products.

 

I am the Administrator and I can do everythign else so what is the story with Assets.

 

I found example questions for the beginning developer Dev 401 exam at www.salesforcecertification.com but I can't find any for the advanced exam Dev 501. 

 

I have also tried uCertify and Self Test Software but no look there.

 

I have made up my own questions while I was studying but you need to practice, practice, practice before doing these exams no matter how much experience you have.

 

Does anyone have sample questions or a web site I can go to to download them.

Thanks.

 

When I set-up a page to display to the public only the fields which are mandatory in the back end object are displayed.

Picklists do not display at all. 

Can anyone tell me why this is happening?

I want to allow people to register for an event I have created a VFP for this however I'm not sure how to allow "Anonymous" people to access this page ( people who do not have salse force accounts).  What are the setps involved in this.

Thansk.

 

I am using the free developer version of salesforce.  I have a formula field which I want to re-calculate when the status is set to closed.

 

I tried the following

 

IF(ISPICKVAL(Status__c, "Closed"), TODAY(),null)

 

Check Systax didn't like it so it just deleted it and pretended everything was ok by giving me a nice little green message saying so and then sticking its head in the sand.

 

How can I get Check Systax to pull its head out of the sand and tell me what it is upset about :-)

 

I also tried

IF(ISPICKVAL(Status__c, "Closed"), TODAY(),TODAY())

 

which is completely useless but Check Syntax got rid of it too.

Then I tried 

 

IF(1=1, TODAY(),TODAY())

 

and Check Syntax was happy so it didn't delete my formula which is completely useless.

 

 

 

Two Sys Admins can't see each others data Why?

 

I am using the Free developer version of salesforce and I have two users

Me and a user called bob.smith2.

 

We are both System Administrators and can both do anything but we can't see each others data.

The security of the objects is very loose everyone can see them and even edit data.

So why can't we see each others data?

I have a trigger which I want to disable (it generates data for one field and the import I am doing doesn't need that data generated)

 

If the trigger is active I can deploy it.  If the trigger is inactive I can't deploy it.

 

WHAT THE HELL IS THIS ABOUT?

 

I have another trigger which I can deploy when it is inactive.

I have a trigger which creates a new opportunity when an asset has a status of Paid and has an expiry date.

This code works fine when records are input using the web interface but when I tried to import 5,000 records using the DataLoader only 23 records imported and the rest were rejected because of SOQL limits on this trigger.

 

I need to know is my code very innefficient?

I thaught I had taken care to ensure that there was as few inserts and updates as possible.

 

Strangely when I re-imported the records they imported without any problems except MY TRIGGER SEEMS TO HAVE BEEN IGNORED SALESFORCE DID NOT RUN IT.  IS THAT POSSIBLE?

 

 

trigger CreateOpportunities on Asset (after update, after insert) {
    Boolean NewOpp = false;
    List <Opportunity> OppToUpdate = new List <Opportunity> {};
    List <Opportunity> OppToInsert = new List <Opportunity> {};
    for(Asset aset: Trigger.new){
        if (aset.Status == 'Paid'){
            Opportunity opp = null;
            try {
                opp =  [select Name,ACCOUNTID,CurrencyIsoCode,CLOSEDATE,Asset__c from Opportunity where asset__c =: aset.ID limit 1];
            } catch (Exception e){}
            if (opp == null) {
                opp = new Opportunity();
                NewOpp = true;
            }
            opp.ACCOUNTID = aset.AccountID;
            opp.Name = 'Automated Opportunity for ' + aset.Name;
            opp.CurrencyIsoCode = aset.CurrencyIsoCode;
            opp.CLOSEDATE = aset.Maintenance_Expires__c;
            opp.Asset__c = aset.ID;
            if (NewOpp){
                opp.StageName = 'Work in Progress';
                OppToInsert.add(opp);
                // insert opp;
            } else {OppToUpdate.add(opp);}
            NewOpp = false;
        }
    }

    if (OppToUpdate.size() > 0) {update OppToUpdate;}
    if (OppToInsert.size() > 0) {insert OppToInsert;}
}

I am trying to re-create the Products page using VFP and it all works except the Default Revenue Schedule.

I looked at the Page Layout for this and I can't figure out where this section comes from or how to re-create it in VFP.  The only field that relates to revenue is called CanUseRevenueSchedule.

 

Can anyone tell me how this Default Revenue Schedule can be re-produced in VFP?

Thansk

I want a Visual Force Page to send an e-mail when it is opened and I tried to do this with an extension but it did not work.

Can an extension to a VFP which uses a standard controller send an e-mail?

I have tried the following.

1. The debug logs appear to show the messages being sent.

2. My triggers send e-mails to the same address so there is nothing wrong there.

3. I have sent messages to different servers so it is not the server.

4. The extension code executes without errors.

5. The e-mail addresses are correct.

My code is below, any suggestions would be grate thanks?

Visual Force Page
<apex:page sidebar="false" showHeader="false" extensions="EmailPDFController2" standardController="mycompany_Invoice__c">
<p>Sending Email</p>
</apex:page>

APEX Class
public class EmailPDFController2 {
    public EmailPDFController2 (ApexPages.StandardController controller){    
         try {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{'test2@test2.com'};
            String[] CopyToAddresses = new String[]{'test@test1.com','test3@test3.com'};
            mail.setToAddresses(toAddresses);
            mail.setCcAddresses(CopyToAddresses);
            String msg = 'Hellow';            
            mail.setPlainTextBody(msg);
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
        } catch (Exception e){}
    }
}


Log Entrhy

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
11:30:10.071 (71679000)|EXECUTION_STARTED
11:30:10.071 (71737000)|CODE_UNIT_STARTED|[EXTERNAL]|066U0000000GXQs|VF: /apex/mycompanyInvoicePDF
11:30:10.074 (74704000)|CODE_UNIT_STARTED|[EXTERNAL]|01pU00000012Pwn|EmailPDFController2 <init>
11:30:10.074 (74722000)|SYSTEM_MODE_ENTER|true
11:30:10.075 (75730000)|METHOD_ENTRY|[1]|01pU00000012Pwn|EmailPDFController2.EmailPDFController2()
11:30:10.075 (75828000)|METHOD_EXIT|[1]|EmailPDFController2
11:30:10.076 (76837000)|SYSTEM_CONSTRUCTOR_ENTRY|[5]|<init>()
11:30:10.076 (76875000)|SYSTEM_CONSTRUCTOR_EXIT|[5]|<init>()
11:30:10.076 (76910000)|SYSTEM_METHOD_ENTRY|[5]|LIST<String>.add(Object)
11:30:10.076 (76930000)|SYSTEM_METHOD_EXIT|[5]|LIST<String>.add(Object)
11:30:10.076 (76944000)|SYSTEM_CONSTRUCTOR_ENTRY|[6]|<init>()
11:30:10.076 (76965000)|SYSTEM_CONSTRUCTOR_EXIT|[6]|<init>()
11:30:10.076 (76985000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77000000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77018000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77032000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77270000)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
11:30:10.077 (77302000)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
11:30:10.077 (77324000)|SYSTEM_METHOD_ENTRY|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77342000)|SYSTEM_METHOD_EXIT|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77389000)|SYSTEM_METHOD_ENTRY|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.085 (85895000)|EMAIL_QUEUE|[11]|bccSender: false, saveAsActivity: true, useSignature: true, toAddresses: [test2@test2.com], ccAddresses: [test@test1.com, test3@test3.com], plainTextBody: Hellow,
11:30:10.086 (86044000)|SYSTEM_METHOD_EXIT|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.086 (86068000)|CODE_UNIT_FINISHED|EmailPDFController2 <init>
11:30:10.649 (89096000)|CUMULATIVE_LIMIT_USAGE
11:30:10.649|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 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
  Number of script statements: 8 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 1 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

11:30:10.649|CUMULATIVE_LIMIT_USAGE_END

11:30:10.089 (89131000)|CODE_UNIT_FINISHED|VF: /apex/mycompanyInvoicePDF
11:30:10.089 (89143000)|EXECUTION_FINISHED

I want a Visual Force Page to send an e-mail when it is opened and I tried to do this with an extension but it did not work.

 

Can an extension to a VFP which uses a standard controller send an e-mail?

 

I have tried the following.

 

1. The debug logs appear to show the messages being sent.

2. My triggers send e-mails to the same address so there is nothing wrong there.

3. I have sent messages to different servers so it is not the server.

4. The extension code executes without errors.

5. The e-mail addresses are correct.

 

My code is below, any suggestions would be grate thanks?

 

Visual Force Page
<apex:page sidebar="false" showHeader="false" extensions="EmailPDFController2" standardController="mycompany_Invoice__c">
<p>Sending Email</p>
</apex:page>

APEX Class
public class EmailPDFController2 {
    public EmailPDFController2 (ApexPages.StandardController controller){    
         try {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{'test2@test2.com'};
            String[] CopyToAddresses = new String[]{'test@test1.com','test3@test3.com'};
            mail.setToAddresses(toAddresses);
            mail.setCcAddresses(CopyToAddresses);
            String msg = 'Hellow';            
            mail.setPlainTextBody(msg);
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
        } catch (Exception e){}
    }
}


Log Entrhy

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
11:30:10.071 (71679000)|EXECUTION_STARTED
11:30:10.071 (71737000)|CODE_UNIT_STARTED|[EXTERNAL]|066U0000000GXQs|VF: /apex/mycompanyInvoicePDF
11:30:10.074 (74704000)|CODE_UNIT_STARTED|[EXTERNAL]|01pU00000012Pwn|EmailPDFController2 <init>
11:30:10.074 (74722000)|SYSTEM_MODE_ENTER|true
11:30:10.075 (75730000)|METHOD_ENTRY|[1]|01pU00000012Pwn|EmailPDFController2.EmailPDFController2()
11:30:10.075 (75828000)|METHOD_EXIT|[1]|EmailPDFController2
11:30:10.076 (76837000)|SYSTEM_CONSTRUCTOR_ENTRY|[5]|<init>()
11:30:10.076 (76875000)|SYSTEM_CONSTRUCTOR_EXIT|[5]|<init>()
11:30:10.076 (76910000)|SYSTEM_METHOD_ENTRY|[5]|LIST<String>.add(Object)
11:30:10.076 (76930000)|SYSTEM_METHOD_EXIT|[5]|LIST<String>.add(Object)
11:30:10.076 (76944000)|SYSTEM_CONSTRUCTOR_ENTRY|[6]|<init>()
11:30:10.076 (76965000)|SYSTEM_CONSTRUCTOR_EXIT|[6]|<init>()
11:30:10.076 (76985000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77000000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77018000)|SYSTEM_METHOD_ENTRY|[6]|LIST<String>.add(Object)
11:30:10.077 (77032000)|SYSTEM_METHOD_EXIT|[6]|LIST<String>.add(Object)
11:30:10.077 (77270000)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
11:30:10.077 (77302000)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
11:30:10.077 (77324000)|SYSTEM_METHOD_ENTRY|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77342000)|SYSTEM_METHOD_EXIT|[11]|LIST<Messaging.SingleEmailMessage>.add(Object)
11:30:10.077 (77389000)|SYSTEM_METHOD_ENTRY|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.085 (85895000)|EMAIL_QUEUE|[11]|bccSender: false, saveAsActivity: true, useSignature: true, toAddresses: [test2@test2.com], ccAddresses: [test@test1.com, test3@test3.com], plainTextBody: Hellow,
11:30:10.086 (86044000)|SYSTEM_METHOD_EXIT|[11]|Messaging.sendEmail(LIST<Messaging.Email>)
11:30:10.086 (86068000)|CODE_UNIT_FINISHED|EmailPDFController2 <init>
11:30:10.649 (89096000)|CUMULATIVE_LIMIT_USAGE
11:30:10.649|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 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
  Number of script statements: 8 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 1 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

11:30:10.649|CUMULATIVE_LIMIT_USAGE_END

11:30:10.089 (89131000)|CODE_UNIT_FINISHED|VF: /apex/mycompanyInvoicePDF
11:30:10.089 (89143000)|EXECUTION_FINISHED

 

 

I have a page which is extended by the "EmailPDFController" class as seen bleow.

The problem is that the getContent call cuases an error and I have no idea why.

 

What I am trying to do is create a pdf and mail it to myself.  Creating the pdf works fine but sending it to myself is not working.

 

See code below.  Try and catch blocks are deliberatly commented out.

 

public with sharing class EmailPDFController {
    public EmailPDFController (ApexPages.StandardController controller){    
        // try {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{'firstname.lastname@company.domain'};
            String[] CopyToAddresses = new String[]{'tname@company.domain','firstname.lastname@company.domain'};
            mail.setToAddresses(toAddresses);
            // mail.setCcAddresses(CopyToAddresses);
            mail.setBccAddresses(CopyToAddresses);
            mail.setReplyTo('x@y.com');        
            mail.setSenderDisplayName('x y');
            mail.setSubject('PDF Invoise ');
            // mail.setBccSender(false);
            mail.setUseSignature(false);
            String msg = '<p><b>Hellow</b></p>';


            PageReference congratsPage = ApexPages.currentPage();
            Blob b = congratsPage.getContent();
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('MyPDF.pdf'); // neat - set name of PDF
            efa.setBody(b); //attach the PDF
            mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            
            mail.setHtmlBody(msg);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});
//        } catch (Exception e){}
    }
    
    @IsTest(SeeAllData=true) public static void testEmailPDFController() {
        ApexPages.StandardController c;
        EmailPDFController EPDFC = new EmailPDFController(c);
        try {
            // System.assertEquals(EPDFC.EmailPDFController(),null);    
        }
        catch (Exception e){}
    }
}

I am looking at site.com and while it all looks very good I am left with a simple question.  Can I create visual force pages with it and import them into my site created in salesforce "propper"?

If not then what is site.com all about?

 

All the tutorials tell me hwo to create pages with site.com but I don't see how to integrate my salesforce "propper" sites and objects with this tool.

 

I am trying to insert assets using the data loader but it does not give me the assets object in the list of objects.  Also I can't find a "New" assets button when I go into Products.

 

I am the Administrator and I can do everythign else so what is the story with Assets.

 

Two Sys Admins can't see each others data Why?

 

I am using the Free developer version of salesforce and I have two users

Me and a user called bob.smith2.

 

We are both System Administrators and can both do anything but we can't see each others data.

The security of the objects is very loose everyone can see them and even edit data.

So why can't we see each others data?