• gautam
  • NEWBIE
  • 125 Points
  • Member since 2010

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 22
    Replies

I have an requirement-

 

i have two images which should be invisible by default .

When a button is clicked ,  first button should be visible and second should be in invisible mode.

And when clicked again the second button should be visible.

 

Can we make images invisible by default in VF.

Can anyone help me with soln.

 

Thanks in advance.

 

 

Hi All,

 

I am trying to write a formula

 

if(( CreatedDate > 2005-10-08T01:02:03Z),name,'fail')

 

but its not working..giving the error "Syntax error. Missing ')'  ".

 

Can anyone help me where i am going wrong ?

  • October 07, 2010
  • Like
  • 0

Hi all,

 

We have written a batch apex class to process a large no of accounts, say 200k+ accounts.

The batch job runs fine upto 30K-35K accounts, but when the accounts records are more than 40K, it throws Apex heap size too large exception.

 

Have anyone faced this issue before ? please help us with any work around to avoid hitting this limit ...thanks..

  • September 13, 2010
  • Like
  • 0

Hi all,

 

We have a requirement where we need to assign different color to different billing cities and plot those cities on dynamic google map. We calculate the color for cities in controller like blue  marker color, red marker color etc.

 

now when we try to plot these cities in dynamic google map with marker color. It does not come up properly.

 

Issues around dynamic google maps are
1>It is not consistent everytime.Sometimes the map does not appear at all.
2>When we try to assign different colors to cities, it does not work.It works only for a single color marker.
3>We need to provide delay in the form of alert messages in code so that all cities are mapped properly with InfoWindow information.

 

If anyone has worked on dynamic google map, please help us out. Thanks.

  • August 20, 2010
  • Like
  • 0

Hi Guys,

 

I have written a batch apex controller for my vf page.

In execute method of batch apex controller, i have a string variable "sample" and it is defined as

public String sample {get; set;} in that class.

 

but when i pass this variable to my page, it gives me null value.

i have used system.debug to check its value in my class and its showing the required value inside execute method.

 

So please help me on how this value can be passed to page correctly.Thanks

Hi All,

 

In my controller , i am trying to retrieve more than 10000 records. But because we have a limit of 10000 records in salesforce, i am not able to do this.

 

Can anybody please tell me how we can query >10000 records in controller or some workaround for this ?

Hi..

I have scenario where I need to check existance of record in some custom  Object1 for each insertion of  records in another Custom  Object2 depending on 2 fields Combination  values.
There is another custom junction object exist between these objects which have a relation with both the object.
So, I need to check whether a record exist in Custom Object1 for specific combination of values inserted in custom object2.If exist I need to upadte the record in the Custom object1  with a field value of custom object2 .If not I have to insert a new record for those Combination field values in custom object1.

As the Combination of values to be checked is more it is becoming quite cumbersome and leading to use of lots of maps and list.

Can anyoone share a code or suggest how this could be acheived.

Hi all,

 

I have written the url rewriter class to construct friendly urls for cmsforce. But i am not able to use some other field except page name to get the final url. I have used a text field url name in page object to get the final url.

 

Please see my code below and let me know if i am missing something !

 

 

global class myurlrewriter implements Site.UrlRewriter {

 //Variables to represent the friendly URLs for pages assuming 3 account managers
 String DIRECTORY = '/internal/';
 

 //Variables to represent my custom Visualforce pages that display page information

 String VISUALFORCE_PAGE = '/page?pageid=';

 // The first global method for mapping external URL to an internal one

 global PageReference mapRequestUrl(PageReference myFriendlyUrl){

    String url = myFriendlyUrl.getUrl();

    if(url.startsWith(DIRECTORY)){

       String name = url.substring(DIRECTORY.length(),url.length());

       //Select the ID of the page that matches the name from the URL

       Page__c site_page = [select id,PageTemplate__r.id  from Page__c where name =:name LIMIT 1];
       
       //Construct a new page reference in the form of my Visualforce page

       return new PageReference(VISUALFORCE_PAGE + site_page.id+'&tempid='+site_page.PageTemplate__r.id);

    }

    //If the URL isn't in the form of a cmsforce page, continue with the request

    return null;

  }

  // The second global method for mapping internal Ids to URLs

  global List<PageReference> generateUrlFor(List<PageReference> mySalesforceUrls){

    //A list of pages to return after all the links have been evaluated

    List<PageReference> myFriendlyUrls = new

    List<PageReference>();

    for(PageReference mySalesforceUrl : mySalesforceUrls){

      //Get the URL of the page

      String url = mySalesforceUrl.getUrl();

      //If this looks like a page that needs to be mapped, transform it

      if(url.startsWith(VISUALFORCE_PAGE)){

        //Extract the ID from the query parameter

        String id= url.substring(VISUALFORCE_PAGE.length(), url.length());

        //Query for the name of the cmsforce page to put in the URL

       Page__c site_page2 = [select url_name__c from Page__c where id =:id LIMIT 1];
        
        
        //Construct the new URL
       
        myFriendlyUrls.add(new PageReference(DIRECTORY+ site_page2.url_name__c));
        
        
     }  

     else {

       //If this doesn't start like an cmsforce page, don't do any transformations

       myFriendlyUrls.add(mySalesforceUrl);

     }

  }

  //Return the full list of pages

  return myFriendlyUrls;

  }

}

Hi guys,

 

According to general behaviour of web tabs, the site opens within salesforce.

But when i added google analytics as web tab and logged into it, it navigates to google nalytics site.

Users would not like to navigate away from salesforce when they access google analytics from salesforce.

 

Any idea or workaround would be helpful !

Hi all,

 

I have a requirement where i need read all existing cookies and comapre with a particular cookie(say x) in visualforce using javascript. If that particular cookie exist ,then on clicking a button it should go to url A, if that cookie does not exist, it should go to url b(login screen).

 

Sample code which is not working as of now.

<apex:page showHeader="false" sidebar="false" >

<b> Hello !!</b>

<p> You have logged in as {!$User.FirstName} {!$User.LastName}</p> <br/><br/>

<p> Your profile is {!$Profile.Name}..</p><br/><br/>

<script>

 

function Get_Cookie() {

    // first we'll split this cookie up into name/value pairs

    // note: document.cookie only returns, not the other components

    var a_all_cookies = document.cookie.split( ';' );

    var a_temp_cookie = '';

    var cookie_name = '';

    var cookie_value = '';

    var b_cookie_found = false; // set boolean t/f default f

    var i = '';

 

    for ( i = 0; i < a_all_cookies.length; i++ )

    {

        // now we'll split apart each pair

        a_temp_cookie = a_all_cookies[i].split( '=' );

 

 

        // and trim left/right whitespace while we're at it

        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

 

        // if the extracted name matches passed check_name

        if ( cookie_name == 'abcd' )

        {

            b_cookie_found = true;

            // note that in cases where cookie is initialized but no value, null is returned

            return cookie_value;

            alert('found it');

            window.location =  "http://www.google.com";

            break;

        }

        a_temp_cookie = null;

        cookie_name = '';

 

    }

    if ( !b_cookie_found )

    {

        return null;

        window.location = "https://www.yahho.com";

    }

}

 

</script>

 

 

<INPUT value="click" onclick="Get_Cookie()" />

</apex:page>

Hi All,

 

I have a requirement to add my cases component on home page layout.

How can i go about it without creating a complete visualforce page ?

Hi All,

 

I am writing a controller where i have a search field on VF page.when a text is entered in search area and clicked on search button , it looks for an existing cookie.If the cookie exist it goes to url A otherwise to url B.but when i used it in my page, the error is "System.NullPointerException: Attempt to de-reference a null object" .Please help me

 

My code :

public class searchingtest
{
public string searchtext{get;set;}

public PageReference searchbutton()
{       
Cookie Name= ApexPages.currentPage().getCookies().get('Name');
String cname=Name.getName();
If(cname=='googlecompc_usen')

{
PageReference pageRef1 = new PageReference('http://www.google.com+searchtext');
pageRef1.setredirect(true);
return pageRef1;
}

else

{
PageReference pageRef2 = new PageReference('https://www.google.com');
pageRef2.setredirect(true);
return pageRef2;

}
}
}

Hi All,

 

I have created a site with 3 visualforce pages. The landing page shows some branding and has links to register and login.

When i click on login, it goes to partner portal login page.

 

Since the partner portal login page is not matching with my other pages, i want to configure this login page.

Can anyone of you please help me on how can i do it ?

Hi Guys,

 

I have 6-7 images and i have a area in my VF page  where i need to include these images which will be rotating in a interval like 5 seconds.These images will be links to other pages also.

 

Can anyone let me know how to go about it ?

Hi All,

 

I have 3 vf pages .!st page is eventdetails page where i have all outputfields showing event details .In this page i have a button called proceed for registration .The controller code for this page is

 

public  class  Proceedbutton {
     
     private  final  ApexPages.StandardController  controller;
 
     public  Proceedbutton (ApexPages.StandardController  stdController) {
         this.controller =  stdController;
    }
    
    
    
   Static Id id1=ApexPages.currentPage().getParameters().get('id');
    
    
    
    public  PageReference  proceed()
    {
         Pagereference  EventRegister=  Page.EventRegister;
         EventRegister.setRedirect(True);
         return  EventRegister;
         
    }
    Public static Id getid()
    { return id1;}
    }

Here in this controller I am trying to get the event id in the id1 variable after that it goes to Eventregister page.

 

 

In Eventregister page,User enters his information and clicks register .Here I have controller which stores the data and goes to tranks vf page .

 

Here’s the code

 

public  class  Registerbutton {

     private  final  ApexPages.StandardController  controller;
 
     public  Registerbutton (ApexPages.StandardController  stdController) {
         this.controller =  stdController;
    }
    
     public  PageReference  Register()
    {
       Registrant__c   reg = (Registrant__c)controller.getRecord();
       
       
       reg.Event__c=Proceedbutton.getid();
       //reg.Event__c='a06S0000002VZMw';
       insert  reg;
       Pagereference  EventThankyou =  Page.EventThankyou  ;
       EventThankyou.setRedirect(True);
       return  EventThankyou;
    }
    }

 

 

In this controller , just before saving the registrant record, I am calling the getid() method on proceedbutton controller to get the eventid .I am trying to link all registrants to that event by doing so.Event__c is a lookup field on Registrant object pointing to Event object

 

But I am not getting the expected result  in the line reg.Event__c=Proceedbutton.getid();

 

Can anyone please help me what I am doing wrong here ?

Hi All,

 

I have a look up field as Event Name in my registrant visualforce page.

When a user clicks on this registrant vf page via site ,  the lookup field Event Name should already have a predefined value in it .How is it possible ?

 

Can we change the url of vf page in such a way that the look up field will contain the value we want ?

 

Hi All,

 

I have two objects Event__C and Registrant__C .on Registrant object we hav a lookup field event link pointing to event object .

 

Now i have created a VF page on event object which i am displaying on site.

in this page the first part shows details of events using output field and the second part shows registrant object fields so that a site user can register for the event .But i am not able to do it properly .Please help me .

 

Getting error "

 

Error: Invalid field Registrant__r for SObject Event__c

"

Heres the code

 

<apex:page standardController="event__c" sidebar="false" showHeader="false" extensions="Registerbutton">

<table width="90%" align="center">
<tr>
<td>
<apex:form >
<apex:pageBlock title="Welcome For Registration" >

<apex:pageBlockSection title="Event Details">

<apex:Outputfield value="{!Event__c.Name}"  />
</apex:pageBlockSection>


<apex:pageBlockSection title="Guest Information" columns="2">
<apex:inputField value="{!Event__c.Registrant__r.First_Name__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Last_Name__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Company__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Email__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Phone__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Address__c}" />
</apex:pageBlockSection>



<apex:pageBlockButtons location="bottom" >
<apex:commandButton action="{!Register}" value="Register " />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:image value="{!$Resource.elephant1}" width="100%" height="50%" />
</apex:form>
</td>
</tr>
</table>

</apex:page>

Hi All,

 

I have created a visualforce page in site and i send mails to contacts to register for an event.

Then the contacts click on the link in mail which leads them to the visuaforce page of site i created.

 

Now when they see the page, i dont want them to enter all the values like event name and time.

These event name & time fields should get prefilled when they click to register in their mails which takes them to  visualforce page of the site.

 

How can i achieve this ? please help.

Hi All,

I have created a lookup field in active visualforce page of site.
But when i click on the icon to see the values in lookup field, i get the Authorization Required page.

I have checked all security settings, everything looks fine.
Can anyone help me to get this issue resolved .Thanks

Hi All,

 

I am trying to write a formula

 

if(( CreatedDate > 2005-10-08T01:02:03Z),name,'fail')

 

but its not working..giving the error "Syntax error. Missing ')'  ".

 

Can anyone help me where i am going wrong ?

  • October 07, 2010
  • Like
  • 0

Hi all,

 

We have written a batch apex class to process a large no of accounts, say 200k+ accounts.

The batch job runs fine upto 30K-35K accounts, but when the accounts records are more than 40K, it throws Apex heap size too large exception.

 

Have anyone faced this issue before ? please help us with any work around to avoid hitting this limit ...thanks..

  • September 13, 2010
  • Like
  • 0

Hi Guys,

 

I have written a batch apex controller for my vf page.

In execute method of batch apex controller, i have a string variable "sample" and it is defined as

public String sample {get; set;} in that class.

 

but when i pass this variable to my page, it gives me null value.

i have used system.debug to check its value in my class and its showing the required value inside execute method.

 

So please help me on how this value can be passed to page correctly.Thanks

Hi All,

 

In my controller , i am trying to retrieve more than 10000 records. But because we have a limit of 10000 records in salesforce, i am not able to do this.

 

Can anybody please tell me how we can query >10000 records in controller or some workaround for this ?

Hi all,

 

I have written the url rewriter class to construct friendly urls for cmsforce. But i am not able to use some other field except page name to get the final url. I have used a text field url name in page object to get the final url.

 

Please see my code below and let me know if i am missing something !

 

 

global class myurlrewriter implements Site.UrlRewriter {

 //Variables to represent the friendly URLs for pages assuming 3 account managers
 String DIRECTORY = '/internal/';
 

 //Variables to represent my custom Visualforce pages that display page information

 String VISUALFORCE_PAGE = '/page?pageid=';

 // The first global method for mapping external URL to an internal one

 global PageReference mapRequestUrl(PageReference myFriendlyUrl){

    String url = myFriendlyUrl.getUrl();

    if(url.startsWith(DIRECTORY)){

       String name = url.substring(DIRECTORY.length(),url.length());

       //Select the ID of the page that matches the name from the URL

       Page__c site_page = [select id,PageTemplate__r.id  from Page__c where name =:name LIMIT 1];
       
       //Construct a new page reference in the form of my Visualforce page

       return new PageReference(VISUALFORCE_PAGE + site_page.id+'&tempid='+site_page.PageTemplate__r.id);

    }

    //If the URL isn't in the form of a cmsforce page, continue with the request

    return null;

  }

  // The second global method for mapping internal Ids to URLs

  global List<PageReference> generateUrlFor(List<PageReference> mySalesforceUrls){

    //A list of pages to return after all the links have been evaluated

    List<PageReference> myFriendlyUrls = new

    List<PageReference>();

    for(PageReference mySalesforceUrl : mySalesforceUrls){

      //Get the URL of the page

      String url = mySalesforceUrl.getUrl();

      //If this looks like a page that needs to be mapped, transform it

      if(url.startsWith(VISUALFORCE_PAGE)){

        //Extract the ID from the query parameter

        String id= url.substring(VISUALFORCE_PAGE.length(), url.length());

        //Query for the name of the cmsforce page to put in the URL

       Page__c site_page2 = [select url_name__c from Page__c where id =:id LIMIT 1];
        
        
        //Construct the new URL
       
        myFriendlyUrls.add(new PageReference(DIRECTORY+ site_page2.url_name__c));
        
        
     }  

     else {

       //If this doesn't start like an cmsforce page, don't do any transformations

       myFriendlyUrls.add(mySalesforceUrl);

     }

  }

  //Return the full list of pages

  return myFriendlyUrls;

  }

}

Hi all,

 

I have a requirement where i need read all existing cookies and comapre with a particular cookie(say x) in visualforce using javascript. If that particular cookie exist ,then on clicking a button it should go to url A, if that cookie does not exist, it should go to url b(login screen).

 

Sample code which is not working as of now.

<apex:page showHeader="false" sidebar="false" >

<b> Hello !!</b>

<p> You have logged in as {!$User.FirstName} {!$User.LastName}</p> <br/><br/>

<p> Your profile is {!$Profile.Name}..</p><br/><br/>

<script>

 

function Get_Cookie() {

    // first we'll split this cookie up into name/value pairs

    // note: document.cookie only returns, not the other components

    var a_all_cookies = document.cookie.split( ';' );

    var a_temp_cookie = '';

    var cookie_name = '';

    var cookie_value = '';

    var b_cookie_found = false; // set boolean t/f default f

    var i = '';

 

    for ( i = 0; i < a_all_cookies.length; i++ )

    {

        // now we'll split apart each pair

        a_temp_cookie = a_all_cookies[i].split( '=' );

 

 

        // and trim left/right whitespace while we're at it

        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

 

        // if the extracted name matches passed check_name

        if ( cookie_name == 'abcd' )

        {

            b_cookie_found = true;

            // note that in cases where cookie is initialized but no value, null is returned

            return cookie_value;

            alert('found it');

            window.location =  "http://www.google.com";

            break;

        }

        a_temp_cookie = null;

        cookie_name = '';

 

    }

    if ( !b_cookie_found )

    {

        return null;

        window.location = "https://www.yahho.com";

    }

}

 

</script>

 

 

<INPUT value="click" onclick="Get_Cookie()" />

</apex:page>

Hi All,

 

I have a requirement to add my cases component on home page layout.

How can i go about it without creating a complete visualforce page ?

Hi All,

 

I am writing a controller where i have a search field on VF page.when a text is entered in search area and clicked on search button , it looks for an existing cookie.If the cookie exist it goes to url A otherwise to url B.but when i used it in my page, the error is "System.NullPointerException: Attempt to de-reference a null object" .Please help me

 

My code :

public class searchingtest
{
public string searchtext{get;set;}

public PageReference searchbutton()
{       
Cookie Name= ApexPages.currentPage().getCookies().get('Name');
String cname=Name.getName();
If(cname=='googlecompc_usen')

{
PageReference pageRef1 = new PageReference('http://www.google.com+searchtext');
pageRef1.setredirect(true);
return pageRef1;
}

else

{
PageReference pageRef2 = new PageReference('https://www.google.com');
pageRef2.setredirect(true);
return pageRef2;

}
}
}

Hi Guys,

 

While uploading files to Partner portal; I am able to upload a text file as Login Meassage (Under Look and Feel) and see the changes on the partner portal login page. However  the same is not happening for a html file.

Can anyone please let me know how to go about it ?

 

 

 

I have an requirement-

 

i have two images which should be invisible by default .

When a button is clicked ,  first button should be visible and second should be in invisible mode.

And when clicked again the second button should be visible.

 

Can we make images invisible by default in VF.

Can anyone help me with soln.

 

Thanks in advance.

 

 

Hi Guys,

 

I have 6-7 images and i have a area in my VF page  where i need to include these images which will be rotating in a interval like 5 seconds.These images will be links to other pages also.

 

Can anyone let me know how to go about it ?

Hi.

 

Having the below  Objects for example.

1.MyParent(Parent).

2.MyChild(Child).

3.MyXObject

 

Using VF page#1 a record is created in the  MyParent.

In page#2 a record created for the MyXObject.

In page#3 a record created for MyChild and  MyParent record ID is related.

 

From page#1 to page#3 I need to pass the record ID ,not through URL parameters.

To say in simple I need to hold the MyParent record ID till the user logout.

All the above 3 objects use different Apex Class.

 

Any idea is greatly appreciated .

 

cheers

suresh

 

 

Hi All,

 

I have 3 vf pages .!st page is eventdetails page where i have all outputfields showing event details .In this page i have a button called proceed for registration .The controller code for this page is

 

public  class  Proceedbutton {
     
     private  final  ApexPages.StandardController  controller;
 
     public  Proceedbutton (ApexPages.StandardController  stdController) {
         this.controller =  stdController;
    }
    
    
    
   Static Id id1=ApexPages.currentPage().getParameters().get('id');
    
    
    
    public  PageReference  proceed()
    {
         Pagereference  EventRegister=  Page.EventRegister;
         EventRegister.setRedirect(True);
         return  EventRegister;
         
    }
    Public static Id getid()
    { return id1;}
    }

Here in this controller I am trying to get the event id in the id1 variable after that it goes to Eventregister page.

 

 

In Eventregister page,User enters his information and clicks register .Here I have controller which stores the data and goes to tranks vf page .

 

Here’s the code

 

public  class  Registerbutton {

     private  final  ApexPages.StandardController  controller;
 
     public  Registerbutton (ApexPages.StandardController  stdController) {
         this.controller =  stdController;
    }
    
     public  PageReference  Register()
    {
       Registrant__c   reg = (Registrant__c)controller.getRecord();
       
       
       reg.Event__c=Proceedbutton.getid();
       //reg.Event__c='a06S0000002VZMw';
       insert  reg;
       Pagereference  EventThankyou =  Page.EventThankyou  ;
       EventThankyou.setRedirect(True);
       return  EventThankyou;
    }
    }

 

 

In this controller , just before saving the registrant record, I am calling the getid() method on proceedbutton controller to get the eventid .I am trying to link all registrants to that event by doing so.Event__c is a lookup field on Registrant object pointing to Event object

 

But I am not getting the expected result  in the line reg.Event__c=Proceedbutton.getid();

 

Can anyone please help me what I am doing wrong here ?

Hi All,

 

I have a look up field as Event Name in my registrant visualforce page.

When a user clicks on this registrant vf page via site ,  the lookup field Event Name should already have a predefined value in it .How is it possible ?

 

Can we change the url of vf page in such a way that the look up field will contain the value we want ?

 

Hi All,

 

I have created a visualforce page in site and i send mails to contacts to register for an event.

Then the contacts click on the link in mail which leads them to the visuaforce page of site i created.

 

Now when they see the page, i dont want them to enter all the values like event name and time.

These event name & time fields should get prefilled when they click to register in their mails which takes them to  visualforce page of the site.

 

How can i achieve this ? please help.

Hey,

 

I have a inputField that is a lookup, it is: 

 

<apex:inputField value="{!op.Account}" /> op is opporunity.

 

I want to prepopulate that with the ID of the account, it has already been chosen at this point, but i know traditionally value="" is what you use to populate an input field, although it must be an object, in this case its account. How can I push the account value into that input field?