• VF
  • NEWBIE
  • 0 Points
  • Member since 2008

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

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

 

 

cant we use execute anonymous action from eclipse to debug the testmethod for triggers in Apex class uing force.comIDE

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 

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. 

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 

Hi ,
How can an admin get the total number of users who have installed the package created by him.

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 

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. 

 

 

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 

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 

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 

 

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