• acoustic
  • NEWBIE
  • 0 Points
  • Member since 2013

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

Here is the beginning of my test class wehre I'm setting up test records. I'm getting an error: "Error: Compile Error: unexpected token: 'Acct.ID' at line 11 column 107" 

 

Later in the code I can easily access User fields (U.id for example). Why can't I access Acct.Id? Is it because it is in SOQL statement?  Thanks!

 

//set up records
User U = [select id from USer limit 1];

//setup Account record 
Account Acct = ([select id, type__c from Account limit 1]);

Acct_Plan__c ap = ([select Id, Name, Account__c, Planning_Year__c from Acct_Plan__c where Account__c = Acct.Id]);

 

How do you call a Flow from an Apex class and feed it a record id? Please provide specific example

  • March 22, 2013
  • Like
  • 0

Here is the beginning of my test class wehre I'm setting up test records. I'm getting an error: "Error: Compile Error: unexpected token: 'Acct.ID' at line 11 column 107" 

 

Later in the code I can easily access User fields (U.id for example). Why can't I access Acct.Id? Is it because it is in SOQL statement?  Thanks!

 

//set up records
User U = [select id from USer limit 1];

//setup Account record 
Account Acct = ([select id, type__c from Account limit 1]);

Acct_Plan__c ap = ([select Id, Name, Account__c, Planning_Year__c from Acct_Plan__c where Account__c = Acct.Id]);

 

Hi, I play with Andriod and Visaulforce Page (MerchandiseMobile) and I try to use the Camera. All necessary lib's (jquery, phonegap) are included but when I click on the Button to take a picture I get a error msg: "TypeError: Cannot call methode 'getPicture' of undefined". Has anyone a solution for this "error" ??

 

Thanks a lot
Stephan

Does salesforce support swich-case statement and if it is then pls help me with the correct syntax.

  • February 28, 2012
  • Like
  • 0

As of a couple of days ago some users began seeing the following error when attempting to refresh reports in Excel:

 

Unable to open https://na6-api.salesforce.com/&export=1xf=xls&enc=UTF-8. The Internet site reports that the item you requested could not be found. (HTTP/1.0 404)

 

They also mentioned that the spinning globe does not appear like it usually does. SFDC support reffred me to come here and post thsi isue to see if there's something going on with the tool.

 

Please help thank you!

 I tried to create a before trigger, before update trigger on event that would fetch a field from prospect/contact according to the whoid specified .

But when inserting recurring events through bulk . I get the following error:-

 

"UnexpectedException: Apex Event trigger cannot handle batch operations on recurring events."

 

 

Is there any way to avoid this error ?

Hi All,

 

I need to implement a custom button to create a new case and redirect user to edit page of newly created case. This should respect service cloud console. A use case is CSR users can click new case and do so many things before saving the case. So the actual creation time will not be captured if we go with the standard new case. The users may feel the case is not valid and may opt to cancel the case in such scenario, user should be asked for confirmation before canceling the case.

 

For this I created new custom button 'Create and Edit'. This button invokes a visualforce page 'NewCaseCreateEdit'. This VF page is tied to 'NewCaseCreateEditController'.

The VF page calls 'doOnload' controller method. This method

1. Insert a new case

2. Construct return pagereference value and return it

 

This works perfectly in standard Salesforce. However in Service cloud console, a wired Error pop up opens when the user is being redirected to the edit page of the case. The pop up says 'Unknown Error' which has made troubleshooting even more difficult. The debug logs are fine and dont show any error or exception.


Below is the VF and apex code. Please let me know if such a functionality is feasible with service cloud console.

 

Apex Code

public class NewCaseCreateEditController
{
    private ApexPages.StandardController controller;
    
    //==================================================
    // CONSTRUCTOR  
    //==================================================
    public NewCaseCreateEditController(ApexPages.StandardController controller) {
      this.controller = controller;
      
    }
    
    public pageReference doOnload()
    {        
        PageReference            returnValue = null;
        Case                     newCase     = null;
        String                   personAccountID = '';        
        personAccountID = Apexpages.CurrentPage().getParameters().get('parentAcc');
        system.debug('person Account -->'+ personAccountID );
        newCase = new Case(
           Origin = 'Phone'
           ,Status = 'New'           
        );
        
        if(personAccountID!='')
        {
         
             List<Account> personAccounLst = [Select a.PersonContactId From Account a where a.IsPersonAccount = true and a.Id =: personAccountID limit 1];   
             if(personAccounLst.size()==1)
             {
                 newcase.ContactId = personAccounLst[0].PersonContactId;     
             }
        }
         
         
        Savepoint sp = null;
        try{
            sp = Database.setSavepoint();            
            insert newCase;
            returnValue = new ApexPages.StandardController(newCase).edit();            
            returnValue.getParameters().put('isdtp','vw'); //Console Agent                     
            returnValue.getParameters().put('retURL','/'+newCase.id );
            returnValue.getParameters().put('cancelURL',System.Page.AbandonPhoneCase.getUrl()
                    + '?id='
                    + newCase.id);            
            system.debug('Return URL-->'+returnValue);
        }catch(Exception e){
            if(sp != null){
                Database.rollback(sp);
            }
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'An occurred while opening new case',''));
            ErrorUtils.handleError(e);
        }
        return returnValue;
    }
}

 

VF page

<apex:page standardController="Case" extensions="NewCaseCreateEditController" action="{!doOnload}" sidebar="false" showHeader="false">
    <div style="display:none;" id="errorTitle">Insufficient Privileges</div>    
</apex:page>

 

 

Please let me know if you need more details.

 

Thanks,

Gopal

 

 

 

  • April 04, 2011
  • Like
  • 1
I'm looking to find the object types of the WhatId/WhoId fields of the Task and Event objects, so I can query these objects and get more information about them and perform certain automated tasks based on the type.

I found this tech article, which uses the first 3 digits as a marker, but the article also says that this may change at any time:

http://www.sforce.com/us/resources/tn-1.jsp

Is there a better way of getting the object types of WhatId/WhoId fields or querying them based on Id only (no type)?

Thanks!

Hi All,

 

I need to implement a custom button to create a new case and redirect user to edit page of newly created case. This should respect service cloud console. A use case is CSR users can click new case and do so many things before saving the case. So the actual creation time will not be captured if we go with the standard new case. The users may feel the case is not valid and may opt to cancel the case in such scenario, user should be asked for confirmation before canceling the case.

 

For this I created new custom button 'Create and Edit'. This button invokes a visualforce page 'NewCaseCreateEdit'. This VF page is tied to 'NewCaseCreateEditController'.

The VF page calls 'doOnload' controller method. This method

1. Insert a new case

2. Construct return pagereference value and return it

 

This works perfectly in standard Salesforce. However in Service cloud console, a wired Error pop up opens when the user is being redirected to the edit page of the case. The pop up says 'Unknown Error' which has made troubleshooting even more difficult. The debug logs are fine and dont show any error or exception.


Below is the VF and apex code. Please let me know if such a functionality is feasible with service cloud console.

 

Apex Code

public class NewCaseCreateEditController
{
    private ApexPages.StandardController controller;
    
    //==================================================
    // CONSTRUCTOR  
    //==================================================
    public NewCaseCreateEditController(ApexPages.StandardController controller) {
      this.controller = controller;
      
    }
    
    public pageReference doOnload()
    {        
        PageReference            returnValue = null;
        Case                     newCase     = null;
        String                   personAccountID = '';        
        personAccountID = Apexpages.CurrentPage().getParameters().get('parentAcc');
        system.debug('person Account -->'+ personAccountID );
        newCase = new Case(
           Origin = 'Phone'
           ,Status = 'New'           
        );
        
        if(personAccountID!='')
        {
         
             List<Account> personAccounLst = [Select a.PersonContactId From Account a where a.IsPersonAccount = true and a.Id =: personAccountID limit 1];   
             if(personAccounLst.size()==1)
             {
                 newcase.ContactId = personAccounLst[0].PersonContactId;     
             }
        }
         
         
        Savepoint sp = null;
        try{
            sp = Database.setSavepoint();            
            insert newCase;
            returnValue = new ApexPages.StandardController(newCase).edit();            
            returnValue.getParameters().put('isdtp','vw'); //Console Agent                     
            returnValue.getParameters().put('retURL','/'+newCase.id );
            returnValue.getParameters().put('cancelURL',System.Page.AbandonPhoneCase.getUrl()
                    + '?id='
                    + newCase.id);            
            system.debug('Return URL-->'+returnValue);
        }catch(Exception e){
            if(sp != null){
                Database.rollback(sp);
            }
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'An occurred while opening new case',''));
            ErrorUtils.handleError(e);
        }
        return returnValue;
    }
}

 

VF page

<apex:page standardController="Case" extensions="NewCaseCreateEditController" action="{!doOnload}" sidebar="false" showHeader="false">
    <div style="display:none;" id="errorTitle">Insufficient Privileges</div>    
</apex:page>

 

 

Please let me know if you need more details.

 

Thanks,

Gopal

 

 

 

  • April 04, 2011
  • Like
  • 1