• danwatt
  • NEWBIE
  • 30 Points
  • Member since 2011

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

Hi,

 

 I originally had posted asking if ApexPages class fails if called in a schedule (non VF page) what can do.  Well I found out that it does fail.  Is there a built in method that I can do a condition check to confirm if I am executing a schedule and if I am, don't execute the message line.

 

I guess if there isn't a built in method then I have to try passing a value to my method to do the same thing.  just trying not to do that if a built in method exists.

 

 

15:05:37:273 FATAL_ERROR System.FinalException: ApexPages.addMessage can only be called from a Visualforce page

 

 

 public void SendEmail() {
        try {
            Messaging.reserveMassEmailCapacity(2);          
            Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
            mail.setTemplateId(getTemplateId('CFCT_OwnerLeadRepNoMatch'));
            // Specify the address used when the recipientCount reply to the email.
            mail.setReplyTo('SFDCsupport@carefirst.com');
            // Specify the name used as the display name.
            mail.setSenderDisplayName('SFDC Support');
            // Set to True if you want to BCC yourself on the email.
            mail.setBccSender(true);
            mail.setUseSignature(false);
            System.debug('zzz: ' + userids);
            mail.setTargetObjectIds(userIds);
            mail.setSaveAsActivity(false);
            Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail }); 
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.INFO, '<font color="blue">Mass email has been sent</font>');             
            ApexPages.addMessage(myMsg);      
        } catch( EmailException e ) {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.ERROR, '<font color="red">' + e.getMessage() + '</font>');               
            ApexPages.addMessage(myMsg);      
        } catch( exception e ) {
            ApexPages.addMessages(e);
        }
    }

 

 

 

After I have deployed code to our production instance, certain objects continue to show up yellow (changed) in the Force.com Component Deployment screen insde the Force.com IDE. In particular - Email Templates, Custom Objects, Custom Reports. What could be causing that, and what might be a way to fix it?

  • September 13, 2013
  • Like
  • 0

When I start typing the name of a class, and then hit "ctr-space" to bring up content assist, I am getting an error "Content Assist" did not complete normally.  Please see the log for more information.

 

The stacktrace is :

 

java.lang.StringIndexOutOfBoundsException: String index out of range: -1at java.lang.String.substring(Unknown Source)at com.salesforce.ide.ui.editors.apex.assistance.proposals.ClassIntfEnumProposal.construct(ClassIntfEnumProposal.java:83)at com.salesforce.ide.ui.editors.apex.assistance.proposals.ProposalAggregator.construct(ProposalAggregator.java:171)at com.salesforce.ide.ui.editors.apex.assistance.proposals.ApexCompletionProposalDelegate.construct(ApexCompletionProposalDelegate.java:88)at com.salesforce.ide.ui.editors.apex.assistance.ApexCompletionProcessor.computeCompletionProposals(ApexCompletionProcessor.java:93)at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1832)at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)

Hi,

 

I had quite a harrowing weekend trying to deploy a lot of code from a full sandbox to production.  One of the problems I had was slowness.  Using Eclipse and deploying to live took as much as 45 minutes, only to come back with a failure.  I found this particularly frustrating because when everything works in a full copy sandbox, you expect it to work in production.

 

A deployment whose steps took 20 minutes against a full sandbox took 9 hours against production because of errors.  So I'd take four or five minutes to try something to resolve the error and then I'd have to wait another 40 for the deployment to fail.  Even when I was loading only one small class with one small unit test, it still took a long time.

 

I was wondering if I'm the only one experiencing this, and if it's an Eclipse thing or a Salesforce thing.

 

Any tips would be most appreciated.

Hi,

 

 I originally had posted asking if ApexPages class fails if called in a schedule (non VF page) what can do.  Well I found out that it does fail.  Is there a built in method that I can do a condition check to confirm if I am executing a schedule and if I am, don't execute the message line.

 

I guess if there isn't a built in method then I have to try passing a value to my method to do the same thing.  just trying not to do that if a built in method exists.

 

 

15:05:37:273 FATAL_ERROR System.FinalException: ApexPages.addMessage can only be called from a Visualforce page

 

 

 public void SendEmail() {
        try {
            Messaging.reserveMassEmailCapacity(2);          
            Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
            mail.setTemplateId(getTemplateId('CFCT_OwnerLeadRepNoMatch'));
            // Specify the address used when the recipientCount reply to the email.
            mail.setReplyTo('SFDCsupport@carefirst.com');
            // Specify the name used as the display name.
            mail.setSenderDisplayName('SFDC Support');
            // Set to True if you want to BCC yourself on the email.
            mail.setBccSender(true);
            mail.setUseSignature(false);
            System.debug('zzz: ' + userids);
            mail.setTargetObjectIds(userIds);
            mail.setSaveAsActivity(false);
            Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail }); 
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.INFO, '<font color="blue">Mass email has been sent</font>');             
            ApexPages.addMessage(myMsg);      
        } catch( EmailException e ) {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.ERROR, '<font color="red">' + e.getMessage() + '</font>');               
            ApexPages.addMessage(myMsg);      
        } catch( exception e ) {
            ApexPages.addMessages(e);
        }
    }

 

 

 

I have used the same code as provided for exporting in my application.In Windows the excel gets exported in a proper manner but when I try to export in MAC OS I get the code written inside the script tag from Salesforce's side.Here is the gibberish code that I get

 


if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'isAccessibleMode':false,'ampm':['AM','PM'],'locale':'en_US','dateTimeFormat':'M/d/yyyy h:mm a','today':'1/28/2009 2:37 AM','dateFormat':'M/d/yyyy','language':'en_US','siteUrlPrefix':'','userPreferences':[{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':112,'name':'HideInlineEditSplash'}
],'startOfWeek':'1'}
);

 

Is this a SalesForce bug or an error from our side.If it is an error do I need to log a bug??