• #DD
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 6
    Replies
Hi,

I received an automated email from SF that one of my CA signed certificate is going to expire. I need to know do I need to renew or create a new CA signed certificate in "Sandbox" or "Production" instance and then download the .CSR and send it to CA for signing?

Please help.
  • November 05, 2015
  • Like
  • 0
Hi,
I need to customize the events and taks deatils page and i need to add a few custom buttons. can someone tell me how can i add buttons to Events detail page.
  • September 11, 2015
  • Like
  • 0
i am getting VF too many soql queries error, here is the code.

when I click switch from buttons, 'webinar' to 'Email'
public with sharing class campaignFilterController {
    public String bltypeEmail {get; set;}
    Database.QueryLocator qLoc;   
    public Integer totalPages { get; set; } 
    public ApexPages.StandardSetController campaignsSetController {
        get {
            if(bltypeEmail == 'Conference') {
                typeConference('Conference');
                calcPages();
            }
            else if(bltypeEmail == 'Email') {
                typeConference('Email');
            }
            else if(bltypeEmail == 'Webinar') {
                typeConference('Webinar');
            }
            return campaignsSetController;
        }
        set;
    }
    public Contact objContact;
    public String currentContRecordId;
    Decimal dtotalPages;
    Integer iRecordsPerPage = 1;
    public List<Campaign> Campaigns {
        get {
            return (List<Campaign>)campaignsSetController.getRecords();
        }
    }
 
    public campaignFilterController () {
        currentContRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        bltypeEmail = ApexPages.CurrentPage().getparameters().get('Type');
        objContact = [select id,accountid from contact where id=:currentContRecordId];
        System.debug('@@@@@@@' +currentContRecordId);
        System.debug('@@@@@@@' +objContact);
        System.debug('@@@@@@@' +objContact.Id);
        
               
        // You can initialize the set controller using a SOQL query:
        String query;
        query = 'SELECT Id, Name, Type, Status,(select Id from CampaignMembers  where ContactId = \'' + objContact.Id + '\') FROM Campaign';
        campaignsSetController = new ApexPages.StandardSetController(Database.getQueryLocator(query));
        System.debug('@@@@@@@' +objContact.Id);
                       
        // Create the set controller
 
        // Set the number of records to be displayed per page and calculate the number of pages.
        //campaignsSetController.setPageSize(iRecordsPerPage);
        //dtotalPages = (campaignsSetController.getResultSize() / campaignsSetController.getPageSize());
        //dtotalPages = Math.floor(dtotalPages) + ((Math.mod(campaignsSetController.getResultSize(), iRecordsPerPage)>0) ? 1 : 0);
        //totalPages = Integer.valueOf(dtotalPages);
        calcPages();
               
    }
   
    public void typeConference (String Type) {
        //Database.QueryLocator qLoc;
        String query;
        String campaignType = Type;
        //currentContRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        //bltypeEmail = ApexPages.CurrentPage().getparameters().get('Type');
        //objContact = [select id,accountid from contact where id=:currentContRecordId];
      
        query = 'Select Id, Name, Type, Status,(select Id from CampaignMembers where ContactId= \'' + objContact.Id + '\') from Campaign where Type= \'' + campaignType + '\'';
        campaignsSetController = new ApexPages.StandardSetController(Database.getQueryLocator(query));
        calcPages();
    }
        public void calcPages(){
                campaignsSetController.setPageSize(iRecordsPerPage);
                dtotalPages = (campaignsSetController.getResultSize() / campaignsSetController.getPageSize());
                dtotalPages = Math.floor(dtotalPages) + ((Math.mod(campaignsSetController.getResultSize(), iRecordsPerPage)>0) ? 1 : 0);
                totalPages = Integer.valueOf(dtotalPages);
        }
}

<apex:page Controller="campaignFilterController" sidebar="false" standardStylesheets="true" tabStyle="Contact">
    <apex:form id="campaignDetails" >
        <apex:pageMessages />
        <apex:pageBlock title="Campaign Filter" >
            <apex:pageBlockButtons >
                <apex:outputPanel rendered="{!totalPages > 1}" >
                    <table border="0" style="width:100%; text-align: right">
                        <tr>
                            <td style="width:100%">&nbsp;</td>
                            <td style="vertical-align: middle">
                                <apex:actionStatus id="statusPaging">
                                    <apex:facet name="start">
                                        <apex:outputPanel >Please wait...</apex:outputPanel>
                                    </apex:facet>
                                    <apex:facet name="stop" />
                                </apex:actionStatus>
                            </td>
                            <td style="text-align: center; white-space: nowrap">
                                <b>Page:</b><br/>{!campaignsSetController.PageNumber} of {!totalPages}
                            </td>
                            <td style="vertical-align: middle">
                            <apex:commandButton value="Conference" reRender="campaignDetails" >
                            <apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="Conference"/>
                            </apex:commandButton>
                            </td>
                            <td style="vertical-align: middle">
                            <apex:commandButton value="Email" reRender="campaignDetails" >
                            <apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="Email"/>
                            </apex:commandButton>
                            </td>
                            <td style="vertical-align: middle">
                            <apex:commandButton value="Webinar" reRender="campaignDetails" >
                            <apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="Webinar"/>
                            </apex:commandButton>
                            </td>
                            <td style="vertical-align: middle">
                                <apex:commandButton value="|<" action="{!campaignsSetController.First}"
                                disabled="{!Not(campaignsSetController.HasPrevious)}" rerender="campaignDetails" status="statusPaging"/>
                            </td>
                            <td style="vertical-align: middle">
                                <apex:commandButton value="<" action="{!campaignsSetController.Previous}"
                                disabled="{!Not(campaignsSetController.HasPrevious)}" rerender="campaignDetails" status="statusPaging"/>
                            </td>
                            <td style="vertical-align: middle">
                                <apex:commandButton value=">" action="{!campaignsSetController.Next}"
                                disabled="{!Not(campaignsSetController.HasNext)}" rerender="campaignDetails" status="statusPaging"/>
                            </td>
                            <td style="vertical-align: middle">
                                <apex:commandButton value=">|" action="{!campaignsSetController.Last}"
                                disabled="{!Not(campaignsSetController.HasNext)}" rerender="campaignDetails" status="statusPaging"/>
                            </td>
                        </tr>
                    </table>
                </apex:outputPanel> 
            </apex:pageBlockButtons>
 
            <apex:pageBlockTable id="TabRefresh" value="{!Campaigns}" var="campaign" >
                <apex:column value="{!campaign.Name}"/>
                <apex:column value="{!campaign.Status}"/>
                <apex:column value="{!campaign.Type}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
  • September 06, 2015
  • Like
  • 0
Hi,
When i run this query i get Malformed query error;

qLoc = Database.getQueryLocator([Select Id, Name, Type, Status,(select Id from CampaignMembers where ContactId=:'+ objContact.Id +') from Campaign]);
 
  • September 04, 2015
  • Like
  • 0
Hi,

I want to provide pagination in my VF page but am getting errror;

Content cannot be displayed: MALFORMED_QUERY: CampaignMembers WHERE ContactId = :tmpVar1) FROM Campaign ^ERROR at Row:1:Column:83rule parseSingleWhere failed predicate: {c != null}?

VF Page;
<apex:page standardController="Contact" sidebar="false" recordSetVar="Contacts" extensions="CampaignRecords"> <script type="text/javascript"> var win; function openNewPage(contactID){ var win='/_ui/common/data/LookupPage?lkpr='+contactID+'&lktp=701&enableScopes=1&addToCampaign=1''&retURL='+campaignID; openIntegration(win, 'height=500,width=700,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1) //openIntegration(win, 'height=500,width=700,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1) //alert(contentId); // window.opener.location.reload(); return false; } // var previousOnload = window.onload; // window.onload = function() { if (previousOnload) { win.close(); } } </script> <apex:form > <!-- <apex:sectionHeader title="Campaign History" subtitle=""/> <apex:pageBlockSection >Campaign History</apex:pageBlockSection>--> <apex:pageBlock id="campaigns"> <apex:pageBlockButtons location="top"> <apex:commandButton value="Type All" reRender="TabRefresh" > <apex:param name="blTypeAll" assignTo="{!bltypeEmail}" value="TypeAll"/> </apex:commandButton> <apex:commandButton value="Type Email" reRender="TabRefresh" > <apex:param name="blEmail" assignTo="{!bltypeEmail}" value="Email"/> </apex:commandButton> <apex:commandButton value="Type Others" reRender="TabRefresh" > <apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="typeOthers"/> </apex:commandButton> <apex:commandButton value="Add to Campaign" onclick="openNewPage('{!Id}')" > </apex:commandButton> </apex:pageBlockButtons> <apex:outputPanel id="TabRefresh"> <apex:pageBlockTable value="{!campgn}" var="o" rendered="{!NOT(ISNULL(campgn))}"> <apex:column value="{!o.Name}"/ > <apex:column value="{!o.Status}"/ > <apex:column value="{!o.Type}"/ > </apex:pageBlockTable> <apex:panelGrid columns="4"> <apex:commandButton action="{!first}" value="|>"/> <apex:commandButton rendered="{!HasPrevious}" action="{!Previous}" value="<"/> <apex:commandButton rendered="{HasNext}" action="{!next}" value=">"/> <apex:commandButton action="{last}" value=">|"/> </apex:panelGrid> </apex:outputPanel> </apex:pageBlock> </apex:form> </apex:page>

Controller Extn;
public with sharing class CampaignRecords {
    
    public Contact objContact {get;set;}
    public String bltypeEmail {get; set;}
    public String currentContRecordId {get;set;}
    private List<Campaign> campgn {get; set;}
    private List<Campaign> campAll {get;set;}
    public List<Campaign> typeEmailOthers {get; set;}
    //public ApexPages.StandardSetController setCon {get; set;}
    //Public Integer size{get;set;}
    //Public Integer noOfRecords{get; set;}
    
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [Select Id, Name, Type, Status,(select name from CampaignMembers where ContactId = :currentContRecordId) from Campaign]));
                    //[Select Id, Name, Type, Status from Campaign]));                    
            }
            return setCon;
        }
        set;
    }
    
    
    public CampaignRecords(ApexPages.StandardSetController controller) {
        controller.setPageSize(10);
        currentContRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        objContact= [select id,accountid from contact where id = :currentContRecordId] ;
        system.debug('campaign record='+objContact.ID);
    }
    
    public List<Campaign> getCampgn(){
        //List<Campaign> campgn = new List<Campaign>();
       /* for(Campaign c : (List<Campaign>)setCon.getRecords())
            campAll.add(c);*/
              
        if(bltypeEmail  == 'TypeAll' || bltypeEmail  == null || bltypeEmail   == '' || bltypeEmail == ' ') {
            for(Campaign c : (List<Campaign>)setCon.getRecords())
                //if(c.Type != 'Email')
                    campgn.add(c);
            
            //campgn = [Select Id, Name, Type, Status,(select name from CampaignMembers where ContactId = :objContact.Id) from Campaign];
            bltypeEmail ='';
        }
     /*   else  if(bltypeEmail == 'Email'){
            campgn = [Select Id, Name, Type, Status,(select name from CampaignMembers where ContactId =:currentContRecordId) from Campaign where Type ='Email'];
            bltypeEmail ='';
        } 
        else if(bltypeEmail == 'typeOthers')
        {
            campgn = [Select Id, Name, Type, Status,(select name from CampaignMembers where ContactId =:currentContRecordId) from Campaign where Type !='Email'];
            bltypeEmail ='';
        }*/
        system.debug('under type all'+campgn);        
        return campgn ;
    }
        public pageReference refresh() {
        setCon = null;
        getCampgn();
        setCon.setPageNumber(1);
        return null;
    }
     
    public Boolean hasNext {
        get {
            return setCon.getHasNext();
        }
        set;
    }
    public Boolean hasPrevious {
        get {
            return setCon.getHasPrevious();
        }
        set;
    }
  
    public Integer pageNumber {
        get {
            return setCon.getPageNumber();
        }
        set;
    }
  
    public void first() {
        setCon.first();
    }
  
    public void last() {
        setCon.last();
    }
  
    public void previous() {
        setCon.previous();
    }
  
    public void next() {
        setCon.next();
    }
}
  • August 28, 2015
  • Like
  • 0
Hi,

I have embedded a VF page on Contacts, which pulls the campaigns for the said contact an end-user selects. I have created a 'Add to Campaign' button on this VF page, when I click on this button, it opens a window with standard filters like 'My Active  Campaigns', 'My Camapaigns', 'All Active Camaigns', 'All Campaigns'. When I select a campaign, the pop window does not close on it own.

Here is the code sample I am using for implementing this functionality;

<apex:page standardController="Contact" sidebar="false" recordSetVar="Contacts" extensions="CampaignRecords">
    
    <script type="text/javascript">
    function openNewPage(){
        
        var win='/_ui/common/data/LookupPage?lkpr=0031a000003tqzP&lktp=701&enableScopes=1&addToCampaign=1&retURL=%2F0031a000003tqzP';
        openIntegration(win, 'height=500,width=700,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1) 
        //alert(contentId);
        return false;  
        
    }
    var previousOnload = window.onload; 
    window.onload = function() { if (previousOnload) { win.close(); }  }
    </script>
    <apex:form >
        <apex:sectionHeader title="Campaign History" subtitle=""/>
        
        <apex:pageBlock id="campaigns">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Type All" reRender="TabRefresh" >
                    <apex:param name="blTypeAll" assignTo="{!bltypeEmail}" value="TypeAll"/>
                </apex:commandButton>
                <apex:commandButton value="Type Email" reRender="TabRefresh" >
                    <apex:param name="blEmail" assignTo="{!bltypeEmail}" value="Email"/>
                </apex:commandButton>
                <apex:commandButton value="Type Others" reRender="TabRefresh"  >
                    <apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="typeOthers"/>
                </apex:commandButton>
                <apex:commandButton value="Add to Campaign"  onclick="return openNewPage()" >
                </apex:commandButton>
            </apex:pageBlockButtons>
            <apex:outputPanel id="TabRefresh">
                <apex:pageBlockTable value="{!campgn}" var="o" rendered="{!NOT(ISNULL(campgn))}">
                    <apex:column value="{!o.Name}"/ >
                        <apex:column value="{!o.Status}"/ >
                            <apex:column value="{!o.Type}"/ >
                            </apex:pageBlockTable>
                        </apex:outputPanel>
                    </apex:pageBlock>
                </apex:form>
            </apex:page>
 
  • August 26, 2015
  • Like
  • 0
Hi,
I have a requirement wherein I have to replace the Opp. related list with custom VF page to support filters. Can anyone give some hints? Thanks.
  • August 13, 2015
  • Like
  • 0
I was gong through the Apex code and found out a code line;

Map<ID, List<Contacts>> mapCntList1 = new Map<ID, List<Contacts>>();

I was wondering this statement could have been written like this also;
Map<ID, Contacts> mapCntList2 = new Map<ID, Contacts>();
If the list declaration in "mapCntList1" is correct, can anyone tell when this should be used and when "mapCntList2" should be used?

Thanks
  • August 12, 2015
  • Like
  • 0
Hi,

I received an automated email from SF that one of my CA signed certificate is going to expire. I need to know do I need to renew or create a new CA signed certificate in "Sandbox" or "Production" instance and then download the .CSR and send it to CA for signing?

Please help.
  • November 05, 2015
  • Like
  • 0
Hi,
When i run this query i get Malformed query error;

qLoc = Database.getQueryLocator([Select Id, Name, Type, Status,(select Id from CampaignMembers where ContactId=:'+ objContact.Id +') from Campaign]);
 
  • September 04, 2015
  • Like
  • 0
Hi,

I have embedded a VF page on Contacts, which pulls the campaigns for the said contact an end-user selects. I have created a 'Add to Campaign' button on this VF page, when I click on this button, it opens a window with standard filters like 'My Active  Campaigns', 'My Camapaigns', 'All Active Camaigns', 'All Campaigns'. When I select a campaign, the pop window does not close on it own.

Here is the code sample I am using for implementing this functionality;

<apex:page standardController="Contact" sidebar="false" recordSetVar="Contacts" extensions="CampaignRecords">
    
    <script type="text/javascript">
    function openNewPage(){
        
        var win='/_ui/common/data/LookupPage?lkpr=0031a000003tqzP&lktp=701&enableScopes=1&addToCampaign=1&retURL=%2F0031a000003tqzP';
        openIntegration(win, 'height=500,width=700,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1) 
        //alert(contentId);
        return false;  
        
    }
    var previousOnload = window.onload; 
    window.onload = function() { if (previousOnload) { win.close(); }  }
    </script>
    <apex:form >
        <apex:sectionHeader title="Campaign History" subtitle=""/>
        
        <apex:pageBlock id="campaigns">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Type All" reRender="TabRefresh" >
                    <apex:param name="blTypeAll" assignTo="{!bltypeEmail}" value="TypeAll"/>
                </apex:commandButton>
                <apex:commandButton value="Type Email" reRender="TabRefresh" >
                    <apex:param name="blEmail" assignTo="{!bltypeEmail}" value="Email"/>
                </apex:commandButton>
                <apex:commandButton value="Type Others" reRender="TabRefresh"  >
                    <apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="typeOthers"/>
                </apex:commandButton>
                <apex:commandButton value="Add to Campaign"  onclick="return openNewPage()" >
                </apex:commandButton>
            </apex:pageBlockButtons>
            <apex:outputPanel id="TabRefresh">
                <apex:pageBlockTable value="{!campgn}" var="o" rendered="{!NOT(ISNULL(campgn))}">
                    <apex:column value="{!o.Name}"/ >
                        <apex:column value="{!o.Status}"/ >
                            <apex:column value="{!o.Type}"/ >
                            </apex:pageBlockTable>
                        </apex:outputPanel>
                    </apex:pageBlock>
                </apex:form>
            </apex:page>
 
  • August 26, 2015
  • Like
  • 0
Hi,
I have a requirement wherein I have to replace the Opp. related list with custom VF page to support filters. Can anyone give some hints? Thanks.
  • August 13, 2015
  • Like
  • 0
I was gong through the Apex code and found out a code line;

Map<ID, List<Contacts>> mapCntList1 = new Map<ID, List<Contacts>>();

I was wondering this statement could have been written like this also;
Map<ID, Contacts> mapCntList2 = new Map<ID, Contacts>();
If the list declaration in "mapCntList1" is correct, can anyone tell when this should be used and when "mapCntList2" should be used?

Thanks
  • August 12, 2015
  • Like
  • 0