• Jeeedeee
  • NEWBIE
  • 193 Points
  • Member since 2007

  • Chatter
    Feed
  • 7
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 41
    Replies
I can't get the Developer Console to work. All the other sys admins in my org have no problems but mine won't run a query. The menu items don't drop down and I get the following error.

Use the Query Editor tab to write and execute SOQL queries. Results are displayed in the Query Results Grid. Use the grid to create, update, and delete data. Take a quick tour...

I am using Chrome and it's up to date. I cleared all History but that hasn't helped either. frozen inoperable dev console
Hi,

I am trying find search results based on a custom text field on account, which contains the '-' minus character. The custom field is called Copy_Birthdate__pc and contains value "1982-01-19"

Since there is a minus, I have to escape it with a \ to use it in the Database.search, but I am not getting any values. Anybody has any idea why there are no results? In normal global search I can find the records

[code]
String safeSearchString = '1982\-01\-19';         
String searchQuery = 'FIND {' +safeSearchString +'} IN ALL FIELDS RETURNING Account(id, Name, Copy_BirthDate__pc  ) ,Contact(Id)';
System.debug('The value of searchQuery' +searchQuery);
List<List<SObject>> searchList = Search.query(searchQuery);
List<SObject> accounts =   searchList.get(0);
List<SObject> contacts =   searchList.get(1);
System.debug('Size of accounts: ' +accounts.size());
System.debug('Size of contacts: ' +contacts.size());
[/code]




All,

 

I'm trying to create a simple Custom Action using the Case Feed developer guide documentation. I simply want a new action which is, effectively, a tab to fill out the important fields on a new case. I'm having a couple issues:

 

  1. The documentation says it's as simple as adding a new visualforce page, but it seems that the standard styling and field bindings don't work in quite the same way. When using <apex:inputfield>, labels aren't auto populated and styled and fields aren't laid out based upon the attributes set within the parent "pageblocksection" tag. Is there a way around this, or do they simply have to be styled?
  2. The label for the custom action seems to be the developer name for the page. Is there any way around this? I can't use spaces in my page name and like to categorise my visualforce page names in a way that wouldn't be very clear to other users.
  3. Using the <apex:outputlabel> value attribute with "{!$ObjectType.case.fields.<<FieldName>>.label}" sometimes outputs"common.api.soap.wsdl.Field@14f7af8d.label}" on the page instead of the field label

Is the documentation simply not completely accurate when it comes to how compatible visualforce pages are with the csae feed? If so, what resources should I look at to code these requirements? I'm not very expert in javascript, but can learn as need be, as long as I know where to look!

 

With thanks,

Andy

Hi All,

 

   

I created a VF page with required input fields and a validation rule along with a command buttons ( "Update" buttons). While submitting the information if I does not input on one of the required fields, It displays the validation rule error message and at the same time all fields are get cleared.

 

But, I like to keep all data on the fields, but display error message.


How to resolve this "Fields get cleared" problem... Please suggest me

 

Thanks,

 

 

 

<apex:page Controller="MyAccount">
    <apex:form >    
    <apex:outputPanel id="AuthorizedContacts">    
    <apex:message/>
    <h2>{!primaryContact.Name}</h2><br/>
    <apex:commandbutton action="{!addAuthContact}" value="Add Contact" rerender="AuthorizedContacts" rendered="{!addAuthContact == false}"/>
    
        <apex:repeat value="{!newAuth}" var="a">
        <apex:outputpanel rendered="{!addAuthContact}">
            {!a.Contact_Type__c}<br/>
            <h4>Name &amp; Contact</h4><br/>
              
                FIRST NAME* <apex:inputField value="{!a.FirstName}" id="contact-first-name" required="true"/>
                LAST NAME* <apex:inputField value="{!a.LastName}"  id="contact-last-name" required="true"/>
                PHONE* <apex:inputField value="{!a.Phone}"  id="contact-phone" required="true"/>
                EMAIL ADDRESS* <apex:inputField value="{!a.Email}"  id="contact-email" required="true"/> 
                
            <h4>Contact Address</h4><br/>
            
                ADDRESS 1 <br/><apex:inputText value="{!a.Contact_Address_Line_1__c}"  id="contact-addr-1"/><br/>
                ADDRESS 2 <br/><apex:inputText value="{!a.Contact_Address_Line_2__c}"  id="contact-addr-2"/><br/>
                CITY <br/><apex:inputText value="{!a.Contact_Town_City__c}"  id="contact-city"/><br/>
                POST CODE <br/><apex:inputText value="{!a.Contact_Postal_Code__c}"  id="contact-postal"/><br/>
                COUNTY <br/><apex:inputText value="{!a.Contact_County__c}"  id="County"/><br/>
                
                COUNTRY<br/>
                <apex:SelectList value="{!CountryName}" size="1">
                    <apex:selectOptions value="{!lstCountry}"></apex:selectOptions>
                </apex:SelectList><br/>
            
            <h4>Is This Authorized Contact Part of Your:</h4><br/>
                <apex:Inputcheckbox value="{!a.IsHousehold__c}"/>
                <label>Household</label>
                <apex:Inputcheckbox value="{!a.IsBusiness__c}"/>
                <label >Business</label><br/>
                <apex:messages rendered="{!IsValidate}" styleClass="errorMsg"/><br/>
            <apex:commandbutton styleClass="cancel" action="{!cancelAuth}" value="Cancel" immediate="true" rerender="AuthorizedContacts"/>
            <apex:commandButton styleClass="button-medium" action="{!saveAuth}" value="Save Updates" rerender="AuthorizedContacts"/>
        
          </apex:outputPanel>      
        </apex:repeat>
        </apex:outputPanel>
    </apex:form>
</apex:page>

 

 

public class MyAccount {
    
    private Id uid;
    public Id aid{get;set;}
    public Id cid{get;set;}
	
	public string CountryName {get;set;}
	
    public Boolean IsValidate{get;set;}
    public Boolean addAuthContact{get;set;}
    
    public User objUser{get;set;} 
    public Contact primaryContact;
	
    public list<Contact> newAuth;
	
    public MyAccount(){
	
        uid = UserInfo.getUserId();
        getObjUser();    
    }
    
    public List<SelectOption> getlstCountry()
    {  list<SelectOption> options = new list<SelectOption>(); 
        try{
            list<Country__c> ls = [select Name,LZ_Country_Id__c,Id from Country__c];
            
			 	Country__c uk = [select Name,LZ_Country_Id__c,Id from Country__c Where Name = 'United Kingdom'];
            
			 	options.add(new SelectOption(uk.Id,uk.Name));
				
            for(Country__c o:ls){
                if(o.Name != 'United Kingdom')
                options.add(new SelectOption(o.Id,o.Name));
            }
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        }  
        return options;
    }
	
    public void getObjUser(){
        try {
            uid = Apexpages.currentPage().getParameters().get('id');
            if(uid != null){
            objUser = [Select   User.ContactId,
                                User.AccountId,
                                User.UserType
                        From    User
                        Where   User.Id = :uid ];
            cid = objUser.ContactId;
            aid = objUser.AccountId;    
            }
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        } 
    }
    
    public Contact getprimaryContact(){
        try
        {
            if(cid != null){
                primaryContact = [Select    Contact.Id,
                                            Contact.Name,
                                    From    Contact
                                    Where   Contact.Id =:cid];
            }
        }catch(Exception ex){
            System.debug('Error From ' + ex.getMessage());
        } 
        return primaryContact;
    }    
  
    public list<Contact> getnewAuth(){
        try
            {   
                newAuth = new list<Contact>();
                Contact ac = new Contact();
                if(aid != null) {
                    ac.AccountId = aid;
                    ac.Contact_Type__c = 'Authorized Contact';
                } 
                newAuth.add(ac);    
        }
        catch(Exception ex)
        {
                System.debug('Error From' + ex.getMessage());
        }   
         return newAuth;
    }
    
    public PageReference addAuthContact(){
        try{
            getnewAuth();
            addAuthContact = true;
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        }
        return null;
    }   
     
    public PageReference cancelAuth(){
        try{
            newAuth = null;
            addAuthContact = false;
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        }
        return null;
    }
    
    public PageReference saveAuth() {  
        
         try{
        List<Contact> tempCon = new List<Contact>();
        if(newAuth != null)  {      
            for(Contact t : newAuth)
            {
                t.Contact_Country__c = CountryName ;                
                tempCon.add(t);
            }
        }
        insert tempCon;
        addAuthContact = false;
        }catch(DmlException ex){
        	if(newAuth[0].IsBusiness__c == false && newAuth[0].IsHousehold__c == false){
        		IsValidate = true;
        	}        	
            ApexPages.addMessages(ex);
        }
        return null;
    }
}

 

 

 

 

 

 

Hello Everyone,

 

When we refresh Sub tab by refreshSubtabById(), it also refreshes custom console component in sidebar which is not desired in my case. Even refreshSubtabById() documentation in "Service Cloud Console Integration Toolkit Developer's Guide" states as below given:

"Note that this method doesn't refresh sidebars or custom console components. For more information, see Custom Console
Components Overview in the Salesforce online help."

 

Any help to prevent custom console component reload on refreshing subtab will be much appreciated.

 

Thanks.

Hi,

I am generating visualforce page as Excel by adding "contenttype="application/vnd.ms-excel"" in the <apex:page> tag. The excel is getting generated but formatting is bad... how do i format ? Can anyone give me example.

I've brought this up with Premier support and keep getting told that I need to modify my code and the following issue I am having is working as intended.

 

I have this query in a User Trigger: Profile p1 = [SELECT ID from Profile WHERE Name = 'System Administrator'];

 

When the trigger fires with a user that has "English" as their language on their user record, the query returns one row, the Standard System Administrator profile.

 

When the trigger fires with a user that has "Spanish" as their language on their user record, a "System.QueryException: List has no rows for assignment to SObject" exception is thrown. That's because the API has translated "System Administrator" into "'administrador del sistema"

 

Up until this point, Salesforce is suggesting I add a "or Name =''administrador del sistema' " to my where clause or that I specifically check what locale the running user is in and execute a different query specifically for them, but neither of these seem like a reasonable solution. What if I have users that use 10 different languages? Do I really need to handle all these additional or clauses in my SOQL statements? What happens when even more additional languages are available natively?

 

I bring this up because it's not really a big deal to change the one line of code, but it is a big deal to go through all of our custom code, duplicate/modify it for each and every language, and then update all the test classes to check it. 

 

Is there a way or a function I can use to say that regardless of the user's selected langauge, always run this Trigger or Class in English?

 

Thanks in advance.

Hi Board,

I'm facing a issue in trigger where in i'm trying to perform a dml statement using List<sObject>.

It throws exception for me when i have more then 900 records in my list.

Error message is stated below:

System.TypeException: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking.

 

I recently upgraded my Force.com IDE (and all projects) to the Winter '12 release. Since upgrading, I've been observing that when I attempt to run unit tests against an Apex class, it often takes a very long time to execute. Even relatively simple tests sometimes take a minute or two to complete. The time doesn't seem to be spent during test execution, but rather during the "preparing results..." phase (based on the progress indicator in the IDE). Reducing the log level doesn't seem to have any impact one way or the other. I've also seen it simply get stuck in the "preparing results..." phase to the point where I had to kill the Eclipse process. Anyone else seeing this?

Hello.  I have a Parent__c object and a Child__c object.  I have a custom list button on Child__c object and I am using URLFOR to select a record type (the "p3" parameter) and fill in a field for the Child object.

The cancelURL parameter is not working - when I click Cancel on the Child data entry screen, there is a refresh but I am returned to the Child screen instead of the Parent record screen.

Do I have the cancelURL parameter formatted correctly?  If I enclose it with curly braces and a !, then I get a syntax error when trying to save the button code.

 

Is this occurring because of save="1"?  I need this because I am selecting a record type and need to skip the record type selection screen.

{!URLFOR($Action.Child__c.New, null, [
CF00N40000001euw3=Parent__c.Name,
p3="012400000009RQP",
retUrl=URLFOR($Action.Parent__c.View, Parent__c.Id, null, true),
cancelUrl=URLFOR($Action.Parent__c.View, Parent__c.Id, null, true),
save="1"
], true)}

 

 

Hello everybody,

 

I have a problem with my code. I have created a new page for the account. I only want to show this page, for certain record types. So I created a redirect page, which redirects the user to either the original page, or the new account page. Below is my code.

 

 

	public PageReference redirectToPage() { 
		System.debug('In redirectToPage from AccountRedirectController');
		PageReference newPage = null; 
 		System.debug('Getting record type parameter:' +ApexPages.currentPage().getParameters().get('RecordType'));
		if(ApexPages.currentPage().getParameters().get('RecordType') == RECORDTYPE_OTHER_ACCOUNT.Id) {
			System.debug('Creating newPage from step with selected record types');
			newPage = Page.NewAccountPage1;
			newPage.getParameters().put('RecordType', RECORDTYPE_OTHER_ACCOUNT..Id);
		} else {
			if(ApexPages.currentPage().getParameters().get('RecordType') != null && ApexPages.currentPage().getParameters().get('RecordType') != RECORDTYPE_TP_ACCOUNT.Id) {
				System.debug('*** information **'+ApexPages.currentPage().getParameters().get('RecordType'));
				newPage = new Pagereference('/001/e?retURL=/001/o&RecordType='+ApexPages.currentPage().getParameters().get('RecordType')+'&ent=Account'); 
				newPage.getParameters().put('nooverride', '1');
			}
		}
		return newPage;
	}

 

 

The problem is with the line

 

ApexPages.currentPage().getParameters().get('RecordType')

 This returns null, when the user only has rights to one specific recordtype. While if the user has rights to multiple recordtypes, and he selects one this line always has a valid ID.

 

Why is the record type not set if the user has only access to one specific record type? And how do I get this specific recordtype in my code, so that I can build a correct redirect?

 

 

Any help would be appreciated, thanks, Jan-Dirk

 

 

I'm sorry for such a stupid question but I'm at a complete loss.

 

Any idea why this doesn't work:

 

 

<apex:messages style="font-color:red;"/>

 


<apex:messages style="font-color:red;"/>

 

I get the messages, but no color :(

Hello,

 

I am a newbie Apex Developer trying to solve an issue with calling the StandardController.edit() method.

 

I created a custom Organization__c object for a user to enter info about their company.   I want logic in the class to limit t 1 instance of Organization__c, so I over-rode the "New" button on the object to point to a Visualforce page that calls my determinePageRedirect method.  If the list of Organization__c is > 0, it returns a PageReference to the edit page using the current ID.  If the list is null, I want to call StandardController.edit() to show the regular new page for Organization__c.  

 

Code works as expected when this.existingOrganization.size () > 0. however, I get an error message "cannot call edit() on null object when that list is empty. Seems like I need some mojo on my StandardController instantiation to make this work. Any ideas? Any help is greatly appreciated - this is driving me nuts!

 

Thanks

 

Apex Class

 

public class OrganizationValidation {

	//declare a private controller variable
	private ApexPages.StandardController controller;
	
	private Organization__c org {get;set;}
	
	//populate list of existingOrganizations
	public List<Organization__c> existingOrganizations;
		public List<Organization__c> getExistingOrganizations(){
			return existingOrganizations;	
	}

	//instatiate class
	public OrganizationValidation(){	
	}
	
	//standard controller constructor
	public OrganizationValidation(ApexPages.StandardController pController) {
        this.controller = pController;
        System.debug('***this.controller: ' +this.controller);
		
		//need StandardController to be aware of current context
		
		
		this.org = (Organization__c)pController.getRecord();
		System.debug('***org: '+ org);

    	OrganizationRedirect();
    }
    
	//Run these methods when we hit the Visualforce page
	public PageReference OrganizationRedirect(){
		
			
		//invoke method to query if there is an Organization__c result
		queryOrganizations();
		
		//invoke method to redirect based on if/then
		determinePageRedirect();
		
		return null;
	
	}
	
	//PageReference method – button on Visualforce page calls
	public PageReference editButtonRedirect() {

		PageReference editRedirect;
		for(Organization__c org: this.existingOrganizations){
				Organization__c myOrg = org;
				editRedirect = new PageReference ('/' + myOrg.id + '/e');
		
		}
	
		return editRedirect;
	
	}
		
	public void queryOrganizations(){
		//query the orgID
		this.existingOrganizations = [Select id, Name From Organization__c];
		//System debug
		System.debug('***existingOrganizations: '+existingOrganizations);
		
	}
	
	//Method to run if/else statement to redirect page
	public PageReference determinePageRedirect(){
	
		PageReference redirectPage;
		if (this.existingOrganizations.size() > 0){
			
			redirectPage = new PageReference ('apex/OrganizationRedirect');
			
		}else{
			
			//Show new page
			redirectPage = this.controller.edit();
			
		}
	
return redirectPage;
	
	}
}

 

Visualforce Page

 

<apex:page standardController="Organization__c" extensions="OrganizationValidation" action="{!determinePageRedirect}">
	<apex:outputPanel >
		<apex:form >
			<h1>Warning</h1>
			<p>You already entered your Organization's information.  Please edit the existing record.</p>
			<apex:commandButton action="{!editButtonRedirect}" value="Edit Organization" />
		</apex:form>
	</apex:outputPanel>
</apex:page>

 

 

 

 

 

I have developed a VF page and I am using standard styles for the apex form. I customized the page using my css styles

but no matter what I do, I am unable to get rid of the pageblock border (thin black border) that is appearing on the right side

and at the bottom of the page..any help is greately appreciated!!