• sandeep var
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
hi,

I am creating pageblock tables dynamically based on number of record types, so i used dynamic component.

can somebody help me in using a command link in the page block table using dynamic component.. here is my code snippet..

how can i give command link a dynamic value   (when i tried using link this Comlink.value = '{!d.FirstName}' it is using as a string instead of the value of the  {!d.FirstName}'.


<apex:page showheader="false" standardController="Lead" extensions="RealtimeLeadDashboard">
<apex:pagemessages ></apex:pagemessages>
<apex:form >
  <apex:actionPoller action="{!refreshDocs}" rerender="docsTable" interval="5"/>
    <apex:outputPanel id="docsTable">
        <apex:dynamicComponent componentValue="{!Pageblock}"/>
    </apex:outputPanel>
          <apex:outputPanel rendered="{!refreshPage}">
   <script>
      window.top.location='/{!LeadID}';
   </script>
</apex:outputPanel>

</apex:form>
</apex:page>


public Component.Apex.PageBlock getPageblock()
    {
        Component.Apex.PageBlock PG = new Component.Apex.PageBlock();
        // get the queue id of the real time queue
        Group objQueue = [SELECT CreatedById,CreatedDate,DeveloperName,DoesIncludeBosses,DoesSendEmailToMembers,Email,Id,LastModifiedById,LastModifiedDate,Name,OwnerId,RelatedId,SystemModstamp,Type FROM Group WHERE Name = 'Real Time Queue' limit 1];
        String Queueid=objQueue.Id;
        // getting the record type from campaign object.       
        Map<String,String> RecordMap = new Map<String,String>();
        for(Campaign cam : [Select Id, Record_Type__c FROM Campaign]) {
        RecordMap.put(cam.Record_Type__c, cam.id);
        }
        List<String> keys = new List<String>(RecordMap.keySet());
        keys.sort();
        system.debug('*** TEST list***'+keys);
        for(integer i=0;i<keys.size();i++){
        String Objch = keys.get(i);
        list<lead> RealLeads=[Select id,FirstName,LastName,Company,CreatedDate,Time_In_Queue_Mins__c,County__c,Date_of_Birth__c,Channel_Code__c from Lead Where OwnerId =: Queueid AND Channel_Code__c=:Objch  ORDER BY CreatedDate ASC NULLS LAST limit 10];     
        if(RealLeads.size()!=0){
        Component.Apex.PageBlock pageBlock = new Component.Apex.PageBlock();
        pageBlock.title=Objch ;
        Component.Apex.PageBlockTable DT = new Component.Apex.PageBlockTable();
        DT.value =RealLeads;
        DT.var = 'd';
        Component.Apex.Column Columnvalue1 = new Component.Apex.Column();
        Component.Apex.Column Columnvalue2 = new Component.Apex.Column(headervalue='Name');
        Component.Apex.commandLink Comlink = new Component.Apex.commandLink ();
        Comlink.value = '{!d.FirstName}'; 
        Comlink.expressions.action = '{!goLead}';
        Columnvalue2.childComponents.add(Comlink);
        Component.Apex.Column Columnvalue3 = new Component.Apex.Column();
        Component.Apex.Column Columnvalue4 = new Component.Apex.Column();
        Component.Apex.Column Columnvalue5 = new Component.Apex.Column();
        Columnvalue3.expressions.value='{!d.Time_In_Queue_Mins__c}';
        Columnvalue1.expressions.value='{!d.County__c}';
        Columnvalue4.expressions.value='{!d.Date_of_Birth__c}';
        Columnvalue5.expressions.value='{!d.Channel_Code__c}';
        PG.childComponents.add(pageBlock);
        pageBlock.childComponents.add(DT);
        DT.childComponents.add(Columnvalue2);
        DT.childComponents.add(Columnvalue1);
        DT.childComponents.add(Columnvalue4);       
        DT.childComponents.add(Columnvalue5);
        DT.childComponents.add(Columnvalue3);
        }
       
    }  
        return PG;
    }

Thanks,
Sandeep.
hi,

I am creating pageblock tables dynamically based on number of record types, so i used dynamic component.

can somebody help me in using a command link in the page block table using dynamic component.. here is my code snippet..

how can i give command link a dynamic value   (when i tried using link this Comlink.value = '{!d.FirstName}' it is using as a string instead of the value of the  {!d.FirstName}'.


<apex:page showheader="false" standardController="Lead" extensions="RealtimeLeadDashboard">
<apex:pagemessages ></apex:pagemessages>
<apex:form >
  <apex:actionPoller action="{!refreshDocs}" rerender="docsTable" interval="5"/>
    <apex:outputPanel id="docsTable">
        <apex:dynamicComponent componentValue="{!Pageblock}"/>
    </apex:outputPanel>
          <apex:outputPanel rendered="{!refreshPage}">
   <script>
      window.top.location='/{!LeadID}';
   </script>
</apex:outputPanel>

</apex:form>
</apex:page>


public Component.Apex.PageBlock getPageblock()
    {
        Component.Apex.PageBlock PG = new Component.Apex.PageBlock();
        // get the queue id of the real time queue
        Group objQueue = [SELECT CreatedById,CreatedDate,DeveloperName,DoesIncludeBosses,DoesSendEmailToMembers,Email,Id,LastModifiedById,LastModifiedDate,Name,OwnerId,RelatedId,SystemModstamp,Type FROM Group WHERE Name = 'Real Time Queue' limit 1];
        String Queueid=objQueue.Id;
        // getting the record type from campaign object.       
        Map<String,String> RecordMap = new Map<String,String>();
        for(Campaign cam : [Select Id, Record_Type__c FROM Campaign]) {
        RecordMap.put(cam.Record_Type__c, cam.id);
        }
        List<String> keys = new List<String>(RecordMap.keySet());
        keys.sort();
        system.debug('*** TEST list***'+keys);
        for(integer i=0;i<keys.size();i++){
        String Objch = keys.get(i);
        list<lead> RealLeads=[Select id,FirstName,LastName,Company,CreatedDate,Time_In_Queue_Mins__c,County__c,Date_of_Birth__c,Channel_Code__c from Lead Where OwnerId =: Queueid AND Channel_Code__c=:Objch  ORDER BY CreatedDate ASC NULLS LAST limit 10];     
        if(RealLeads.size()!=0){
        Component.Apex.PageBlock pageBlock = new Component.Apex.PageBlock();
        pageBlock.title=Objch ;
        Component.Apex.PageBlockTable DT = new Component.Apex.PageBlockTable();
        DT.value =RealLeads;
        DT.var = 'd';
        Component.Apex.Column Columnvalue1 = new Component.Apex.Column();
        Component.Apex.Column Columnvalue2 = new Component.Apex.Column(headervalue='Name');
        Component.Apex.commandLink Comlink = new Component.Apex.commandLink ();
        Comlink.value = '{!d.FirstName}'; 
        Comlink.expressions.action = '{!goLead}';
        Columnvalue2.childComponents.add(Comlink);
        Component.Apex.Column Columnvalue3 = new Component.Apex.Column();
        Component.Apex.Column Columnvalue4 = new Component.Apex.Column();
        Component.Apex.Column Columnvalue5 = new Component.Apex.Column();
        Columnvalue3.expressions.value='{!d.Time_In_Queue_Mins__c}';
        Columnvalue1.expressions.value='{!d.County__c}';
        Columnvalue4.expressions.value='{!d.Date_of_Birth__c}';
        Columnvalue5.expressions.value='{!d.Channel_Code__c}';
        PG.childComponents.add(pageBlock);
        pageBlock.childComponents.add(DT);
        DT.childComponents.add(Columnvalue2);
        DT.childComponents.add(Columnvalue1);
        DT.childComponents.add(Columnvalue4);       
        DT.childComponents.add(Columnvalue5);
        DT.childComponents.add(Columnvalue3);
        }
       
    }  
        return PG;
    }

Thanks,
Sandeep.
I keep getting this error on one of my working triggers. Would anyone know how to stop the error System.Exception: Too many SOQL queries: 101 from occurring?

trigger Trigger_EventBeforeInsertUpdate on Event (before insert, before update) {
   
    /** Add **/
    Set<Id> whoIds = new Set<Id>();
    for(Event event: System.Trigger.New){
        whoIds.add(event.whoId);
    }
   
    Map<Id, Contact> contactMap = new Map<Id, Contact>([select Id,Name from Contact where Id in:whoIds]);
    Map<Id, Lead> leadMap = new Map<Id, Lead>([select Id,Name from Lead where Id in:whoIds]);
    /** Add **/
   
   
    for(Event event: System.Trigger.New){
        List<sObject> lobjects;
        string name;
        lobjects = [select Id, Name from Account where Id=:event.WhatId];
        if(lobjects.size() == 1)
            name = ((Account)lobjects[0]).Name;
        else{ 
            lobjects = [select Id, Name from Opportunity where Id=:event.WhatId];
            if(lobjects.size() == 1)
                name = ((Opportunity)lobjects[0]).Name;
            else{ 
                lobjects = [select Id, CaseNumber from Case where Id=:event.WhatId];
                if(lobjects.size() == 1)
                    name = ((Case)lobjects[0]).CaseNumber;
                else{
                    lobjects = [select Id, Name from Campaign where Id=:event.WhatId];
                    if(lobjects.size() == 1)
                    name = ((Campaign)lobjects[0]).Name;
                }
            }     
        }
       
        /**Add**/        
        if (contactMap.containskey(event.whoId) == true) {
            event.Description = 'Related To: ' + name + '\n Contact Name:' + contactMap.get(event.whoId).Name +'\n'+  event.Activity_Comment__c;
        } else if (leadMap.containskey(event.whoId) == true) {
            event.Description = 'Lead Name:' + leadMap.get(event.whoId).Name +'\n'+  event.Activity_Comment__c;
        }
                    
        System.debug('description is set to ' + event.Description);
    }
}
  • June 26, 2014
  • Like
  • 0

I'm trying to sign an XML document in one of my Apex classes.  Does Apex have any built in classes for signing XML documents?  Ie, like using the javax.xml.crypto.dsig.XMLSignature class or the Apache Santuario library?  I've looked at the Crypto.sign function, but I don't think it does what I need it to do (or if it does, please let me know!).

 

Thanks for any suggestions!

 

Kelly