• McFitz13
  • NEWBIE
  • 0 Points
  • Member since 2009

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

We need to embed content within a visual force page. What controller is used?

 

We currently have a link to content but when the guest user profile clicks the link the user gets an error.

 

Page Not Found: /ex/errorduringprocessing.jsp

 

We either need to embed content in visualforce or create a better way to handle a link. 

I asked this question during the recent webinar, but got no answer.

 

How do you test apex code that requires the use of self-service portal users when the DML operation to create self-service portal users is not allowed?

 

For now, outside of my test code, I have to create a dummy account, a dummy contact, and then a dummy self-service portal user. Then I have to hope no one deletes this by accident, or my test code no longer works.

 

I know that, like users, you cannot delete self-service portal users. But you can create users in Apex test code that go away when the test completes.

 

Why can't you create self-service portal users in apex code?

Is it possible to have a button on the detail page of an object and when you click on that button can you run a apex trigger or apex class?

I am getting the above error message on a trigger. I have stripped the trigger way way down to make it easier to diagnose the problem.

 

Here is the complete trigger

 

 

trigger tryi on Contact (before update) {
    string gCode;
    string en;
    en='Segal';
    gCode=LEFT(en,2);
  }

 

and here is the complete error:

Error: Compile Error: Method does not exist or incorrect signature: LEFT(String, Integer) at line 5 column 11

 

But I know that LEFT exists, and I know that 'Segal' is a string, and I know that 2 is an integer. So what am I missing?

 

Thanks.

 

HI,

 

Please Help me in writing Test Class for this :

 

 

public class CancelCase {

    public String strCaseId = ApexPages.currentPage().getParameters().get('id');
    public String strClosingComments {get; set;}    
    public Case objCancelCase {get; set;}
    public List<CaseComment> objCancelCaseCommentList {get; set;}
    
    public CancelCase(ApexPages.StandardController controller) {
        strClosingComments ='';
        objCancelCaseCommentList = [Select Id, ParentId, IsPublished, CommentBody, CreatedById, CreatedDate, SystemModstamp,
                                    LastModifiedDate, LastModifiedById, IsDeleted, ConnectionReceivedId, ConnectionSentId
                                    From CaseComment where ParentId =:strCaseId ];
       }
    
    public List<SelectOption> getStatus(){
      List<SelectOption> options = new List<SelectOption>();
      Schema.DescribeFieldResult fieldResult = Case.Status.getDescribe();
      options.add(new SelectOption('Cancelled', 'Cancelled'));
      return options;
      }
    
    public PageReference save() {
   
      PageReference createCancelCase;
      try{
       if(strClosingComments==null || strClosingComments==''){
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.error,'You must enter Comments'));
              return null;
       }
    
        CaseComment  objLatestCancelComment = new CaseComment();
        objLatestCancelComment.ParentId = strCaseId;
        objLatestCancelComment.CommentBody= strClosingComments;
        objCancelCaseCommentList.add(objLatestCancelComment);
        upsert objCancelCaseCommentList ;
        
        //strCaseId
        Case caseBeingCancelled = [Select Status From Case where Id=:strCaseId];
        caseBeingCancelled.Status = 'Cancelled';
        update caseBeingCancelled;
        
        createCancelCase = new PageReference('/'+strCaseId);
        createCancelCase.setRedirect(TRUE);
 
        }catch(Exception e){
          }
      return createCancelCase ;

}

}

  • March 25, 2011
  • Like
  • 0

A need to create a Datetime value in a given user's timezone.  There are method for the current user and methods for GMT but no method for the current user.

 

Anyone know of a convenient way to do this.  I can get there timezone from the user record.  It will be a string like "America/New_York".  I supposed a could build a table with all the offsets, look up the offset, then construct a datetime in GMT and add the appropriate number of hours.

 

Anyone know of a better way to do this?

 

-Ken

 

I am trying to replicated a web to case form in visualforce.

 

The page sits in a tab on a clients org and at the moment emails me the contents of a form. i have got everything coded so it emails me everything fine.

 

Now what i'm trying to do is exactly copy the salesforce generated web to case form and get the visualforce form to post the form to the address in the html generated form. Unfortulately i'm getting the following error

 

This is the code i'm using in the controller

 

 

public with sharing class CaseExtension {
    
    public Case mycase {get; set;}
    public User localUser {get; set;}
    public String route {get; set;}
    
    public CaseExtension(ApexPages.StandardController stdController) {
        this.mycase = (Case)stdController.getRecord();
        localUser = [SELECT Id, Phone, Email, FirstName, LastName from User where Id =: System.UserInfo.getUserId() LIMIT 1];
        this.mycase.OwnerId = localUser.Id;
        
    }

   public PageReference saveCase(){
       try {
    
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       String[] toAddresses = new String[] {'https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8'};
       mail.setToAddresses(toAddresses);
      
       mail.setPlainTextBody('orgid=00DD0000000Cl9q' + '&retURL=VF_Evo1_Tab&name=' + localUser.FirstName + '&email=' + localUser.Email + '&phone=' + localUser.Phone + '&subject=' + mycase.Subject + '&description=' + mycase.Description + '&00ND0000002wUGd=' + route + '&external=1&submit=Submit' );
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
       }
       catch(System.DMLException e){
           ApexPages.addMessages(e);
           return null;
       }
  //     PageReference p = Page.ThankYou;
  //     p.setRedirect(true);
       return null;
     }
    
}

 

Just wondering if enyone could help me resolve this problem

 

 

Hi

 

I have a custom (Delgate__C) that has two lookups to the Contact table. When there was only one lookup I accessed the Contact data via the Contact__R object. Now that there are two, how to I reference the second related contact  and how does Salesforce know which one I am referring to?

 

Thanks in advance

Ross

  • March 24, 2011
  • Like
  • 0

I am trying build an outer join to display a list of contacts showing if they have a related portal user records or not.

 

I know you can get a list of related contacts from the user object but is it possible to go from contacts to user? 

 

I know this works...Select u.isactive, u.Contact.name From User u but what about Select name, c.user.isactive From Contact c?

 

Any thoughts how I can outer join these two tables and display one list? 

 

Thanks

 

Hi,

 

I am getting empty count results from a GROUP BY query executed through the php toolkit - using the latest partner wsdl (v20).

 

Here is the query:

 

SELECT LeadSource, COUNT(Id) from Lead  GROUP BY LeadSource

 

Using the php print_r function, here is a sample of the results returned in the response records. There is only one entry for [fields] - the count is not returned.

 

Array
(
    [0] => SObject Object
        (
            [type] => AggregateResult
            [fields] => stdClass Object
                (
                    [LeadSource] =>
                )

        )

    [1] => SObject Object
        (
            [type] => AggregateResult
            [fields] => stdClass Object
                (
                    [LeadSource] => Web
                )

        )

    [2] => SObject Object
        (
            [type] => AggregateResult
            [fields] => stdClass Object
                (
                    [LeadSource] => Phone Inquiry
                )

        )

...

 

Would the php toolkit have anything to do with this problem? Is there something else that I have missed?

 

Thanks in anticipation.

 

Colin G

 

  • December 10, 2010
  • Like
  • 0

Hi,

 

We've been experiencing Intermittent Maintenance Page(500/503) errors on our Sites.

We do not receive an Apex Exception email and, in my experience, Apex Exceptions result in Authorization Required Page (401) and not Maintenance Page(500/503). Therefore, this doesn't seem to be related to a bug in our code and is quite possibly an issue on SFDC's side. We can't see any pattern to these errors, so far as we can tell they are random. They are obviously hard to reproduce on demand due to their intermittent nature.

 

Clearly, this problem is very troubling to us so any help would be greatly appreciated.

 

Thanks a lot,

Mike 

I have an APEX Trigger that runs when a Task is created/updated, so it can update the related Case. 

 

Somehow, the trigger is causing the Case Assignment Rules to re-fire, but I don't know what.  Any thoughts?

 

 

 

trigger caseLastActivityDate on Task (after insert, after update) { Map<String, Task> tMap = new Map<String, Task>(); for (Task t : System.Trigger.new) { String whatId = t.WhatId; System.debug('whatId is ' + whatId); if(whatId <> null && whatId.startsWith('500') == true) { Case c = [select Id from Case where Id = :whatId]; if(c.Id <> null) { c.Last_Activity_Date__c = t.LastModifiedDate; update c; } } } }