• VF
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 49
    Questions
  • 39
    Replies

Need to avoid the system address fields being populated with Account address automatically whenever we create a contact from account page.

 

Whenever a contact is being created from an account page the account field is populated automatically and the system address field of contact are populated by account address.

 

Tried overriding the create contact button with scontrol and javascript, but whenever the account is passed while creating a contact the address fields gets populated automatically.

 

Please let me know if any soln?

 

Thanks

shaan



  • July 13, 2011
  • Like
  • 0

Need to avoid the system address fields being populated with Account address automatically whenever we create a contact from account page.

 

Whenever a contact is being created from an account page the account field is populated automatically and the system address field of contact are populated by account address.

 

Tried overriding the create contact button with scontrol and javascript, but whenever the account is passed while creating a contact the address fields gets populated automatically.

 

Please let me know if any soln?

 

Thanks

shaan

  • July 13, 2011
  • Like
  • 0

There is a VF page in which we are using extensions along with the standard controller of an standard object(say account).

For a particular Profile the Create\Edit functionality of the standard object has been removed.

So whenever the user of that particular profile logs in hes not able to edit anything in VF Page where the extension for a standard controller is being used.

 

Please help me how to give edit access on VF page keeping the profile level settings intact.

 

 

REgards,

shaan

 

 

  • June 28, 2011
  • Like
  • 0

Hello,

 

 

I have an issue in Apex triggers can any one help me out: I have a lraedy made two post but didnot get any reply .please help me out as it is very urjent for me.

 

Here is the code of my Apex trigger test class: 

 

public class sampleTest{

static testMethod void WCSFTrigger(){

    Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();

    Individual_Email_Results__c objInsert = new Individual_Email_Results__c();

    objInsert .Hard_Bounce__c = 1; 

    objInsert .Abuse__c = '1';

    objInsert .GlobalUnsubscribe__c = '1';

    objInsert .UniversalUnsubscribe__c = '1';

    objInsert .Unsubscribe__c = '1';

    objInsert .Lead__c = '00Q90000001S4fL';

    objInsert .Contact__c = '00390000001bZ1V';

   

    insert objInsert ;

 

//Here the triggers fires on updation 

    objInsert . Unsubscribe__c = '3'; 

    update objInsert;

 

    Decimal newValue = objInsert .Hard_Bounce__c;//obj.Hard_Bounce__c;

    Decimal oldValue = 2; 

    String contactID = objInsert.Contact__c;//'00390000001bZ1V';

    String leadID = objInsert.Lead__c; 

    

    system.debug(objInsert.Contact__c);

    if(newValue != oldValue)

    {

    

     system.debug(contactID);

    

    if(contactID  != null)

    {

    

         Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=: contactID ];

         system.debug(contact);

         system.debug(contact.HasOptedOutOfEmail);

         if(contact.HasOptedOutOfEmail == true)

               {

                contact.HasOptedOutOfEmail = false;

                   //system.assertEquals(contact.HasOptedOutOfEmail , false); 

               }

               else

               {

                contact.HasOptedOutOfEmail = true;

                   //system.assertEquals(contact.HasOptedOutOfEmail , true);

               }

               update contact;

    }

    

    if(objInsert.Lead__c!= null)

    {

        Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=:objInsert.Lead__c];

         if(lead .HasOptedOutOfEmail == true)

               {

                 system.assertEquals(lead .HasOptedOutOfEmail , true); 

               }

               else

               {

                  system.assertEquals(lead .HasOptedOutOfEmail , true); 


               }

               update lead ;

    }

    

     if( (objInsert.Abuse__c != '2') || (objInsert.GlobalUnsubscribe__c != '2') || (objInsert.UniversalUnsubscribe__c != '2') || (objInsert.Unsubscribe__c != '2'))

        {

            if(objInsert.Contact__c!= null)

            {  

               Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:objInsert.Contact__c];

               system.assertEquals( contact.EmailBouncedReason , 'WhatCounts Hard Bounce'); 

                

               update contact;

                   

            }

            if(objInsert.Lead__c!= null)

            {              

               Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:objInsert.Lead__c];

               system.assertEquals( lead.EmailBouncedReason , 'WhatCounts Hard Bounce'); 

               

               update lead;

            }

         

        }

 

 

I have a problem in writing test class for  code which has bold font .Please let me know if there is any issue.

 

 

 

The trigger is:

 

trigger WCSFTrigger on Individual_Email_Results__c (after update) {

Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();

       for (Individual_Email_Results__c objUpdate: System.Trigger.New) {

       

        Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c,Abuse__c,GlobalUnsubscribe__c,UniversalUnsubscribe__c,Unsubscribe__c,Hard_Bounce_Event_Date__c  from Individual_Email_Results__c where id= :objUpdate.Id];

        string contactID = obj.Contact__c;

        string leadID = obj.Lead__c;

        Decimal newValue = trigger.new[0].Hard_Bounce__c;

        Decimal oldValue = trigger.old[0].Hard_Bounce__c;

       

        if(newValue != oldValue )

        {

            if(contactID != null)

            {  

               Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:contactID ];

               if(contact.HasOptedOutOfEmail == true)

               {

                  contact.HasOptedOutOfEmail = false;

               }

               else

               {

                  contact.HasOptedOutOfEmail = true;

               }

               update contact;

                   

            }

            if(leadId != null)

            {              

               Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId];

               if(lead.HasOptedOutOfEmail == true)

               {

                  lead.HasOptedOutOfEmail = false;

               }

               else

               {

                   lead.HasOptedOutOfEmail = true;

               }

               update lead;

            }

             

        }        

        if( (trigger.new[0].Abuse__c != trigger.old[0].Abuse__c) || (trigger.new[0].GlobalUnsubscribe__c != trigger.old[0].GlobalUnsubscribe__c) || (trigger.new[0].UniversalUnsubscribe__c != trigger.old[0].UniversalUnsubscribe__c) || (trigger.new[0].Unsubscribe__c != trigger.old[0].Unsubscribe__c))

        {

            if(contactID != null)

            {  

               Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:contactID ];

               contact.EmailBouncedReason = 'WhatCounts Hard Bounce';

               contact.EmailBouncedDate = datetime.valueOf(obj.Hard_Bounce_Event_Date__c);

               update contact;

                   

            }

            if(leadId != null)

            {              

               Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:leadID ];

               lead.EmailBouncedReason = 'WhatCounts Hard Bounce';

               lead.EmailBouncedDate =  datetime.valueOf(obj.Hard_Bounce_Event_Date__c);

               update lead;

            }

         

        }

        }

       

 

 

Please let me know if any changes has to be done.

I have followed the APEX DOCS TO WRITE THE CODE. I have already made two posts regarding this issue but didnot get any reply.

 

Thanks

 

  • December 12, 2009
  • Like
  • 0
cant we use execute anonymous action from eclipse to debug the testmethod for triggers in Apex class uing force.comIDE
  • December 12, 2009
  • Like
  • 0
cant we use execute anonymous action from eclipse to debug the testmethod for triggers in Apex class uing force.comIDE
  • December 12, 2009
  • Like
  • 0
 if(contactID != null)
    {
        Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:obj.Contact__c];
         if(contact.HasOptedOutOfEmail == true)
               {
                 system.assertEquals(contact.HasOptedOutOfEmail , true); 
               }
               else
               {
                  system.assertEquals(contact.HasOptedOutOfEmail , true); 

               }
               update contact;
    }
 
thanks
prashanth 

  • December 11, 2009
  • Like
  • 0

Hello, 

 

Here is the trigger which i have written:

This trigger used to update the contact fields when any custom field is updated.

I wrote a test case for the below trigger for that: 

I am getting a code coverage of 6% . can any one help me to get the code coverage.

 

trigger WCSFTrigger on Individual_Email_Results__c (after update) {
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();
       for (Individual_Email_Results__c objUpdate: System.Trigger.New) {        
        Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c,Abuse__c,GlobalUnsubscribe__c,UniversalUnsubscribe__c,Unsubscribe__c,Hard_Bounce_Event_Date__c  from Individual_Email_Results__c where id= :objUpdate.Id];
        string contactID = obj.Contact__c;
        string leadID = obj.Lead__c;
        Decimal newValue = trigger.new[0].Hard_Bounce__c;
        Decimal oldValue =  trigger.old[0].Hard_Bounce__c;

        if(newValue != oldValue)
        {
            if(contactID != null)
            {  
               Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:contactID ];
               if(contact.HasOptedOutOfEmail == true)
               {
                  contact.HasOptedOutOfEmail = false;
               }
               else
               {
                  contact.HasOptedOutOfEmail = true;
               }
               update contact;
                   
            }
            if(leadId != null)
            {              
               Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId];
               if(lead.HasOptedOutOfEmail == true)
               {
                  lead.HasOptedOutOfEmail = false;
               }
               else
               {
                   lead.HasOptedOutOfEmail = true;
               }
               update lead;
            }
             
        }        
        if( (trigger.new[0].Abuse__c != trigger.old[0].Abuse__c) || (trigger.new[0].GlobalUnsubscribe__c != trigger.old[0].GlobalUnsubscribe__c) || (trigger.new[0].UniversalUnsubscribe__c != trigger.old[0].UniversalUnsubscribe__c) || (trigger.new[0].Unsubscribe__c != trigger.old[0].Unsubscribe__c))
        {
            if(contactID != null)
            {  
               Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:contactID ];
               contact.EmailBouncedReason = 'WhatCounts Hard Bounce';
               contact.EmailBouncedDate = datetime.valueOf(obj.Hard_Bounce_Event_Date__c);
               update contact;
                   
            }
            if(leadId != null)
            {              
               Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:leadID ];
               lead.EmailBouncedReason = 'WhatCounts Hard Bounce';
               lead.EmailBouncedDate =  datetime.valueOf(obj.Hard_Bounce_Event_Date__c);
               update lead;
            }
         
        }
        }

 

 

Now here is the Test class for the trigger:

 

 

public class sampleTest{
static testMethod void WCSFTrigger(){
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();

Individual_Email_Results__c objInsert = new Individual_Email_Results__c();
//List<IndividualEmailResult__c> itemsToInsert = new List<IndividualEmailResult__c>(); 
objInsert .Hard_Bounce__c = 1; 
objInsert .Abuse__c = '1';
objInsert .GlobalUnsubscribe__c = '1';
objInsert .UniversalUnsubscribe__c = '1';
objInsert .Unsubscribe__c = '1';
objInsert .Lead__c = '00Q90000001S4fL';
objInsert .Contact__c = '00390000001bZ1V';


//itemsToInsert.add(objInsert );
insert objInsert ;
Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c,Abuse__c,GlobalUnsubscribe__c,UniversalUnsubscribe__c,Unsubscribe__c,Hard_Bounce_Event_Date__c  from Individual_Email_Results__c where id= :objInsert .Id];
Decimal newValue = obj.Hard_Bounce__c;
Decimal oldValue = 2; 
if(newValue != oldValue)
{
    if(obj.Contact__c!= null)
    {
        Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:obj.Contact__c];
         if(contact.HasOptedOutOfEmail == true)
               {
                 system.assertEquals(contact.HasOptedOutOfEmail , true); 
               }
               else
               {
                  system.assertEquals(contact.HasOptedOutOfEmail , true); 

               }
               update contact;
    }
    
    if(obj.Lead__c!= null)
    {
        Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=:obj.Lead__c];
         if(lead .HasOptedOutOfEmail == true)
               {
                 system.assertEquals(lead .HasOptedOutOfEmail , true); 
               }
               else
               {
                  system.assertEquals(lead .HasOptedOutOfEmail , true); 

               }
               update lead ;
    }
    
     if( (obj.Abuse__c != '2') || (obj.GlobalUnsubscribe__c != '2') || (obj.UniversalUnsubscribe__c != '2') || (obj.Unsubscribe__c != '2'))
        {
            if(obj.Contact__c!= null)
            {  
               Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:obj.Contact__c];
                system.assertEquals( contact.EmailBouncedReason , 'WhatCounts Hard Bounce'); 
                //system.assertEquals( contact.EmailBouncedDate , datetime.valueOf('2009-11-24 10:26:00') );
               update contact;
                   
            }
            if(obj.Lead__c!= null)
            {              
               Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:obj.Lead__c];
               system.assertEquals( lead.EmailBouncedReason , null); 
                //system.assertEquals( lead.EmailBouncedDate , datetime.valueOf('2009-11-24 10:26:00') );

               update lead;
            }
         
        }
}       
 }

 

Thanks

shaan 

  • December 11, 2009
  • Like
  • 0

Hello,

 

I wrote a trigger to change a  contact field when an custom object is updated .

 

code:

 

trigger Test on Individual_Email_Results__c (after insert, after update) {
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();


 if(trigger.isinsert)
    {
    
    
    }
    else
    {
     for (Individual_Email_Results__c objUpdate: System.Trigger.New) {
        
        String ID = objUpdate.id;
          Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c from Individual_Email_Results__c where id= :objUpdate.Id];
          string contactID = obj.Contact__c;
          string leadID = obj.Lead__c;
          
          if(contactID != null)
          {          
              //for (Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:'contactId']) {
              Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:contactID ];
              if(contact.HasOptedOutOfEmail == true)
              {
                  contact.HasOptedOutOfEmail = false;
              }
              else
              {
                  contact.HasOptedOutOfEmail = true;
              }
              update contact;
                   
          }
          else
          {
              //for (Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId]) {
              Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId];
              //lead.HasOptedOutOfEmail = true;
              if(lead.HasOptedOutOfEmail == true)
              {
                  lead.HasOptedOutOfEmail = false;
              }
              else
              {
                  lead.HasOptedOutOfEmail = true;
              }

              update lead;
             
          }
    }
}
}

 Now i want to write the same trigger only when the Custom field is updated.

Here the custom field is : Hard_Bounce__c 

for the custom object.

 

 

 

Please help me out this very much urjent for me.

Your help is appreciated always. 

 

Thanks

shaan 

  • November 30, 2009
  • Like
  • 0

Hello,

I have an custom object which has relation with campaign . In that i have a field , if i update the field from the object then the  EmailOptout standard field  from contact or lead  should change.

Can any one help me in writing an apex trigger for this. 

  • November 30, 2009
  • Like
  • 0

Hello,

 

I am facing an error while running the Apex code as:

 

System.Exception: Too many SOQL queries: 10001

 

Can anyone provide me with a solution for this.

I went through the docs  and the discussions for the governor limits but got confused by the posts . 

 

 

Could any one provide a solution to this :

 

 

Your help will be appreciated .... 

 

Thanks

shaan 

  • November 17, 2009
  • Like
  • 0
Hello,
 
i have a problem in retrieving  soql query with mulitple conditions.
 
select leadid,contactid from CampaignMember where campaignmember.lead.Department='Test'  and
campaignmember.contact.Company='Test'
 is not working while its working for seperate single condition.
Is there any query to  retrieve based on multiple conditions as of above. 
Your help is appreciated thanks in advance.
 
shaan 
  • November 05, 2009
  • Like
  • 0
Hello,
 
I have an issue while using the metadata api the issue is -
 
We are using metadata api to get the report information (like criteria, fields selected, etc...). But we are getting error while using the API call 'retrieve'. Error is "java.io.IOException: Non nillable element 'version' is null." We are accessing this API in java. what will be the problem?
 
Please help me out of this issue as its urjent requirement for me. 
 
Thanks and Regards
 


  • October 31, 2009
  • Like
  • 0
Hello,
 
I have an issue while using the metadata api the issue is -
 
We are using metadata api to get the report information (like criteria, fields selected, etc...). But we are getting error while using the API call 'retrieve'. Error is "java.io.IOException: Non nillable element 'version' is null." We are accessing this API in java. what will be the problem?
 
Please help me out of this issue as its urjent requirement for me. 
 
Thanks and Regards
 



  • October 31, 2009
  • Like
  • 0
Hi ,
How can an admin get the total number of users who have installed the package created by him.
  • September 24, 2009
  • Like
  • 0
How can an admin get the total number of users who have installed the package created by him.
  • September 24, 2009
  • Like
  • 0

Hello, 

Can we add a total of nearly 5000 ids to a particular list of string type.If there is any method or soln please help me out.

Thanks

shaan 

  • September 10, 2009
  • Like
  • 0

Hi ,

Below is the class which i am using to retrieve leadis and contactids from campaign which are a total of more then 2000 records from select query using for loop.

 

public class Test

{

   Set<Id> leadid = new Set<Id>();

        Set<Id> contactid = new Set<Id>();

        List<String> emails=new List<String>();

 

public void TestMethod()

{

 

  for(campaignmember camp:[Select leadid,contactid from campaignmember where campaignid=:'campaignId']) {

  leadid.add(camp.leadid);

contactid.add(camp.contactid); 

 

 

 

 

here i am able to run the query which has more than 2000 records in the for loop but unable to add the leadid and contactid to the List<Id> (i.e  leadid , contactid) respectively as shown above.

An exception - collection exceeds maximum size: 1001 is being disaplayed.

 

My actual intenstion is to get the leadids and contactids and run the respective select query and add the email address to a list string emails.

 for (Contact cnt: [Select Email from contact WHERE Id IN :contactid]) 

 {

         if(cnt.Email != null)

         {

              emails.add(cnt.Email);

         }

 } 

 

can any one help me out.Thanks in advance

 

Thanks 

prashanth. 

 

 

  • September 10, 2009
  • Like
  • 0
how can we add leadid and contactid to newly created campaign using asp.net
  • September 02, 2009
  • Like
  • 0

Hello,

I am using standard indian time zone(GMT+5:30) in my application.

Here i am using my sytem Time and saving the data into a  database.

But if my client uses the same datetime from the same DB he should get his system time. 

 

Can i maintain the standard time for both the time zones. if yes , could any one suggest me how to maintain the standard times between countries  or else is there any other alternative.

 

Plaese help me out as its urjent for my application. 

 

Thanks

shaan 

  • August 26, 2009
  • Like
  • 0

There is a VF page in which we are using extensions along with the standard controller of an standard object(say account).

For a particular Profile the Create\Edit functionality of the standard object has been removed.

So whenever the user of that particular profile logs in hes not able to edit anything in VF Page where the extension for a standard controller is being used.

 

Please help me how to give edit access on VF page keeping the profile level settings intact.

 

 

REgards,

shaan

 

 

  • June 28, 2011
  • Like
  • 0
cant we use execute anonymous action from eclipse to debug the testmethod for triggers in Apex class uing force.comIDE
  • December 12, 2009
  • Like
  • 0

Hello,

 

I wrote a trigger to change a  contact field when an custom object is updated .

 

code:

 

trigger Test on Individual_Email_Results__c (after insert, after update) {
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();


 if(trigger.isinsert)
    {
    
    
    }
    else
    {
     for (Individual_Email_Results__c objUpdate: System.Trigger.New) {
        
        String ID = objUpdate.id;
          Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c from Individual_Email_Results__c where id= :objUpdate.Id];
          string contactID = obj.Contact__c;
          string leadID = obj.Lead__c;
          
          if(contactID != null)
          {          
              //for (Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:'contactId']) {
              Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:contactID ];
              if(contact.HasOptedOutOfEmail == true)
              {
                  contact.HasOptedOutOfEmail = false;
              }
              else
              {
                  contact.HasOptedOutOfEmail = true;
              }
              update contact;
                   
          }
          else
          {
              //for (Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId]) {
              Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId];
              //lead.HasOptedOutOfEmail = true;
              if(lead.HasOptedOutOfEmail == true)
              {
                  lead.HasOptedOutOfEmail = false;
              }
              else
              {
                  lead.HasOptedOutOfEmail = true;
              }

              update lead;
             
          }
    }
}
}

 Now i want to write the same trigger only when the Custom field is updated.

Here the custom field is : Hard_Bounce__c 

for the custom object.

 

 

 

Please help me out this very much urjent for me.

Your help is appreciated always. 

 

Thanks

shaan 

  • November 30, 2009
  • Like
  • 0

Hello,

I have an custom object which has relation with campaign . In that i have a field , if i update the field from the object then the  EmailOptout standard field  from contact or lead  should change.

Can any one help me in writing an apex trigger for this. 

  • November 30, 2009
  • Like
  • 0

Hello,

 

I am facing an error while running the Apex code as:

 

System.Exception: Too many SOQL queries: 10001

 

Can anyone provide me with a solution for this.

I went through the docs  and the discussions for the governor limits but got confused by the posts . 

 

 

Could any one provide a solution to this :

 

 

Your help will be appreciated .... 

 

Thanks

shaan 

  • November 17, 2009
  • Like
  • 0
Hi ,
How can an admin get the total number of users who have installed the package created by him.
  • September 24, 2009
  • Like
  • 0

Hello, 

Can we add a total of nearly 5000 ids to a particular list of string type.If there is any method or soln please help me out.

Thanks

shaan 

  • September 10, 2009
  • Like
  • 0

Hi ,

Below is the class which i am using to retrieve leadis and contactids from campaign which are a total of more then 2000 records from select query using for loop.

 

public class Test

{

   Set<Id> leadid = new Set<Id>();

        Set<Id> contactid = new Set<Id>();

        List<String> emails=new List<String>();

 

public void TestMethod()

{

 

  for(campaignmember camp:[Select leadid,contactid from campaignmember where campaignid=:'campaignId']) {

  leadid.add(camp.leadid);

contactid.add(camp.contactid); 

 

 

 

 

here i am able to run the query which has more than 2000 records in the for loop but unable to add the leadid and contactid to the List<Id> (i.e  leadid , contactid) respectively as shown above.

An exception - collection exceeds maximum size: 1001 is being disaplayed.

 

My actual intenstion is to get the leadids and contactids and run the respective select query and add the email address to a list string emails.

 for (Contact cnt: [Select Email from contact WHERE Id IN :contactid]) 

 {

         if(cnt.Email != null)

         {

              emails.add(cnt.Email);

         }

 } 

 

can any one help me out.Thanks in advance

 

Thanks 

prashanth. 

 

 

  • September 10, 2009
  • Like
  • 0

Hello,

 I am using the below code to redirect to the standard salesforce pages as:

 

    public PageReference Save()

    { 

String newPageUrl = 'https://ap1.salesforce.com/701/o';

   PageReference newPage = new PageReference(newPageUrl);

   newPage.setRedirect(true);

   return newPage; 

    } 

 This piece of code helps in navigating the page to campaign default page.Here the url-"https://ap1.salesforce.com/701/o" is the campaigns default page url for my account.

 

Instead of passing the complete url is there any way to redirect to sandard campaign page in pageReference method. 

 

Thanks,

shaan 

  • August 11, 2009
  • Like
  • 0

In my class i have a constructor here i am calling  a method in the constructor so as to  redirect to another Vf page.

Here is the code:

class:

 public class MyClass

{

   public MyClass(ApexPages.StandardController controller)

    {    

  ShowDetails(); 

    }

 

  public PageReference ShowDetails()

   {

   return page.MyPage; 

 

   } 

 

 

 

is there any thing wrong in the code.Help me out guyz

 

Thanks shaan 

  • August 07, 2009
  • Like
  • 0

Hello i am using the action support method in order to fill a drop down on onchange event in another dropdown.The problem is that the values are being repeated in the dropdown.

elow is the design and code for the issue: 

 

code:

 

<apex:selectList id="campaignIds" value="{!status}" size="1">

<apex:actionSupport event="onchange" reRender="statusid" action="{!getStatus}" status="status"/>

  <apex:selectOption itemLabel="--None--" itemValue="--None--" ></apex:selectOption>

  <!--<apex:actionSupport event="onchange" reRender="statusid" action="{!getItemsList}" status="status"/>-->

  <apex:selectOptions value="{!items}"></apex:selectOptions>

  </apex:selectList>

  <apex:actionStatus id="status" startText="Loading..."></apex:actionStatus>

 

<apex:selectList id="statusid"  size="1">

  <apex:selectOption itemLabel="--None--" itemValue="--None--" ></apex:selectOption>

  <apex:selectOptions  value="{!itemsList}"></apex:selectOptions>

  </apex:selectList>

</td>

 

 

here is the controller code for the above design:

 

 

public class CampaignCreation

{

List<Campaign> campaign = new List<Campaign>();

List<Selectoption> options = new List<Selectoption>();

List<Selectoption> optionsList = new List<Selectoption>();

List<CampaignMemberStatus> campMemberStatus = new List<CampaignMemberStatus>();

String campaignId = null;

private String pStatus= null;

    public CampaignCreation(ApexPages.StandardController controller) {

 

    }

public CampaignCreation()

{

//Campaign campaignobj = [select id,Name from Campaign where IsActive=true];

//CampaignMemberStatus campMemberStatus = [Select Label From CampaignMemberStatus WHERE CampaignId ='campaignId'];

 

 

}

public String status

    {

        get { return pStatus; }

        set { pStatus= value; }

    } 

public List<SelectOption> getItems()

{

campaign = [select id,Name from Campaign where IsActive=true];

//String campaignId = campaign[0].Id;

for(Integer i=0;i< campaign.size();i++)

{

options.add(new SelectOption(String.valueOf(campaign[i].id),String.valueOf(campaign[i].Name)));

}

return options;

}

public List<SelectOption> getItemsList()

{

campMemberStatus = [Select Label From CampaignMemberStatus WHERE CampaignId =:pStatus];

system.debug(campMemberStatus.size());

for(Integer i=0;i< campMemberStatus.size();i++)

{

//this.pStatus = campaign[i].Id;

optionsList.add(new SelectOption( String.valueOf(campMemberStatus[i].Label),String.valueOf(campMemberStatus[i].Label)));

}

return optionsList;

}

public void getStatus()

{

getItemsList();

}

 

}

 

can any one help me out of this issue

Thanks,

shaan 

 

  • August 04, 2009
  • Like
  • 0
Hello,
Does any one have any idea on dynamic binding in Vfpage. 
 I want to dynamically bind salesforce component from the Apexcode into Vf page.Here is what i am working on:
VFpage:
<apex:form>
<apex:repeat value="{!strings}" var="string" id="theRepeat" >
        <apex:selectList value="{!countries}"   size="1">
            <apex:selectOptions value="{!items}"/>
        </apex:selectList><br/>
</apex:repeat><br/>
<apex:commandButton value="Add More" action="{!add}"/>
</apex:form>
class:
publi class myClass
{
 String[] countries = new String[]{};            
        public PageReference test() {
            return null;
        }            
        public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('US','US'));
            options.add(new SelectOption('CANADA','Canada'));
            options.add(new SelectOption('MEXICO','Mexico'));
            return options;
        }            
        public String[] getCountries() {
            return countries;
        }            
        public void setCountries(String[] countries) {
            this.countries = countries;
        }
}
Firstly i want to display 3 drop down lists with the same values inside in it on page load iam able to do it using repeater then i want a button in the apex VFpage such that when the button is clicked a new  drop down list is added dynamically to the vpage.
on the pageload the repeat control is filled with 3 drop downs but
here i want to add one or  more dropdowns dynamically when clicked on "Add More" command button . 
Your help is appreciated.  
Thanks,
shaan 
  • July 23, 2009
  • Like
  • 0