• Adil_SFDC
  • NEWBIE
  • 35 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 31
    Questions
  • 72
    Replies
Hi All,

I want to display Dashboards tab for community user. The community is created using Napil teplate. Iam not finding ways to display dasboards using napili template. please help.

thanks in advance.

Vedashri
Hi there,

Does Community template Napili support Reports and Dashboards ?

Thanks !
Hi I have a SOQL query that i want to reuse by changing the where clause. I dont want to repeat the SOQL multiple times. How can this be acheived. 

Here is my query 

List<Case> groupedCases = [Select Photographer_Contact__r.Name,Scheduled_Date__c from Case 
                                where RecordType.DeveloperName In('Time_Booking', 'Media_Package', 'Photography') 
                                and Scheduled_Date__c =:dates and Photographer_Contact__r.id = :con.id];
In the above query i need results without Scheduled_Date__c =:dates 
and another query I need results without Photographer_Contact__r.id = :con.id

so that i can use respective results for further processing. 
Or is there a way i can process the resultlist 'groupedcases' not to include them .?

Hi All 
I am trying to write a utility method to get only the weekdays. Is there any easy way out. here is my code so far.  The return is in the form "09/16/2014 - Tue". I just need the Date. 

public class Utility_WorkingDays {
	
	public  List<String> getHeadDates(){
        List<String> formattedDates = new List<String>();
		List<DateTime> headDates = new List<DateTime>();
		DateTime currentDate = DateTime.now();
		//Date currentDate = currentDateTime.Date;
		for (Integer idx=0; idx<28; idx++){
        	headDates.add(currentDate+idx);
	    } 
	    for(DateTime dt: headDates){
	    	String formatDatewithDay = dt.format('MM/dd/yyyy - E');
	    	formattedDates.add(formatDatewithDay);
    	   	for(Integer i = 0; i< formattedDates.size();i++){
	        	String weekend = formattedDates.get(i);
	        	system.debug('here :'+weekend);
	        	if(weekend.contains('Sun') || weekend.contains('Sat')){
	        		
	        		formattedDates.remove(i);
	        	}
        }
	      
	    }
	    system.debug('dates:'+formattedDates);
		return formattedDates;
	}
}


Hi Experts,
I am trying to render a visualforce Page with the change in picklist values. The data I would like to render is the contact names in  a table. which changes depending on the sales Region i choose. 

Here is my page and controller so far. Any help is appreciated.
<apex:page controller="PhotoSchedulerController" tabstyle="Report" sidebar="false">
<apex:form >
<apex:outputPanel id="dataBlocks" >
<apex:sectionHeader title="Field Researcher Schedule for Region"/>

<apex:selectList value="{!contactSalesRegion}" size="1" multiselect="false">
 <b>Field Researcher Schedule for Region</b><apex:selectOptions value="{!SalesRegionsCoveredValues}" > </apex:selectOptions>
<apex:actionSupport event="onchange" action="{!salesRegionCoveredFilter}" reRender="dataBlock" > 
<apex:param name="salesRegionId" assignTo="{!salesRegionId}" value="{!SalesRegionsCoveredValues}"></apex:param>  
</apex:actionSupport> 
</apex:selectList>

<apex:pageBlock >
 
<table class="list" border="0" cellpadding="0" cellspacing="0"  id="dataBlock" >

  <tr>
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;

     <b>Scheduled Date</b>
 
  </tr>
    <tr>
      
      <td>
      </td>
      <apex:repeat value="{!headDays}" var="days">
        <th style="background-color:#00BFFF;">
            {!days}
        </th>
    </apex:repeat>
    </tr>
   
    <tr class="headerRow  ">
      <th style="background-color:#00BFFF;">Photographer: Full Name</th>
      
      <apex:repeat value="{!headDates}" var="heading">
        <th style="background-color:#00BFFF;" class="headerRow ">
           {!heading}
        </th>
      </apex:repeat>
    </tr>
    <apex:repeat value="{!DataRows}" var="dRow">
       <apex:repeat value="{!dRow.contacts}" var="photo">
           <tr>
               <td style="background-color:#d4dadc;">
                  <a href="https://apartments--pre.cs20.my.salesforce.com/{!photo.Id}"> {!photo.Name} </a>
               </td>
            
            <apex:repeat value="{!dRow.cases}" var="count">
           
                <td> 
                 {!count.casenumber}
                </td>
              
            </apex:repeat>

            </tr>
         </apex:repeat>
         
    </apex:repeat>
  </table>
  </apex:pageBlock>
  </apex:outputPanel>
    </apex:form> 
</apex:page>
public class PhotoSchedulerController {

    public String salesRegionId { get; set; }
    public String ContactSalesRegion {get;set;}

    public PageReference salesRegionCoveredFilter() {
    	String contacts =  [Select Id,Name,Sales_Regions_Covered__c from Contact where Sales_Regions_Covered__c= '03'].Sales_Regions_Covered__c;
    	         system.debug('sales region:'+contacts);
    	
        return null;
    }

    public  List<SelectOption> getSalesRegionsCoveredValues() {
       List<SelectOption> options = new List<SelectOption>();
        Schema.DescribeFieldResult salesRegion = Contact.Sales_Regions_Covered__c.getDescribe();
        List<Schema.PicklistEntry> salesRegions = salesRegion.getPicklistValues();
        for(Schema.Picklistentry entry : salesRegions){
            options.add(new SelectOption(entry.getLabel(),entry.getValue()));
        }
        return options;
    } 
    
    public List<String> getHeadDays() {
        List<String> formattedDays = new List<String>();
        List<DateTime> days = new List<DateTime>();
        DateTime currentDay = DateTime.now();
        for (Integer idx=0; idx<28; idx++){
            days.add(currentDay+idx);
        system.debug('DAYS :'+days);
        } 
        for(DateTime dt: days){
            String formattedDay = dt.format('E');
            formattedDays.add(formattedDay);
        }
        return formattedDays;
    }
    
    public List<String> getHeadDates(){
        List<String> formattedDates = new List<String>();
        List<Date> dates = new List<Date>();
        Date currentDate = system.today();
        for (Integer idx=0; idx<28; idx++){
            dates.add(currentDate+idx);
        }
       
        for(Date dt: dates){
            String formattedDate = dt.format();
            formattedDates.add(formattedDate);
           
        }
        return formattedDates;
        }
        
    // retrieves the row wrapper containing the wrapped case headings
    public List<photographerRow> getDataRows(){
        List<String> scheduledDates = new List<String>();
        photographerRow pRow = new photographerRow();
        List<photographerRow> dataRows = new List<photographerRow>();
        for(Contact con : getContacts()){
            pRow.photographer = con.Name;
            pRow.photographerId = con.Id;
            pRow.contacts.add(con);
        }
        for (Integer idx=28; idx>0; idx--) {
            pRow.subtotals.add(idx);
        }
        
        for(Case c : getCaseInfo()){
            pRow.caseNumber = c.caseNumber;
            pRow.cases.add(c);
        }
    
        dataRows.add(pRow);
        return dataRows;
    }
    
    public class photographerRow{
        public String photographer {get; set;}
        public String photographerId {get;set;}
        public String caseNumber{get;set;}
        public List<Contact> contacts {get;set;}
        public List<Case> cases {get;set;}
        public List<Integer> subtotals {get; set;}
        public List<Integer> counts {get; set;}
        // constructor
        public PhotographerRow(){
            contacts = new List<Contact>();
            subtotals=new List<Integer>();
            counts=new List<Integer>();
            cases = new List <Case>();
        }
    }
    
    
    public List<Contact> getContacts(){
        List<Contact>contacts =  [Select Id,Name,Sales_Regions_Covered__c from Contact ];
        return contacts;
    }
    

    
    public List<Case> getCaseInfo(){
        List<String> contactsList = new List<String>();
        List<String> formattedDatesList = new List<String>();
        for(Contact c :  getContacts()){
                        contactsList.add(c.Name);
        }
        List<Date> dates = new List<Date>();
        Date currentDate = system.today();
        for (Integer idx=0; idx<28; idx++){
            dates.add(currentDate+idx);
        }
        system.debug('Dates List :'+dates);
        system.debug('Contact LIst :'+contactsList);
        
        List<Case> cases = [Select id,CaseNumber,Scheduled_Date__c ,Account.Owner.Name,Photographer_Contact__r.Name from Case where RecordType.DeveloperName In('Time_Booking','Media_Package','Photography') 
                                                        and Scheduled_Date__c=:dates];
        system.debug('case queried:'+cases);
        return cases;   
    }   
    
  


    /* public Integer getCaseCount(){
        Integer caseCount;
        List<AggregateResult> groupedCases = [Select count(casenumber),Scheduled_Date__c, Photographer_Contact__r.Name from Case where RecordType.DeveloperName In('Time_Booking', 'Media_Package', 'Photography') and Scheduled_Date__c!=null group by Photographer_Contact__r.Name,Scheduled_Date__c];
        for (AggregateResult ar : groupedCases)  {
                caseCount = Integer.valueOf(ar.get('expr0'));
        }
    return caseCount;
    }*/
}
Thanks for the expert advice. 
Adil

Hi All 

I would like to replicate the attached report in visualforce . 
I want the column headers  to hold the weekdays as shown .
The data in the columns is from Case Object. 0's and 1's represent the number of case records on that particualr day. 
Is there any easy way out.Report to be transformed to Visualforce

Check box to Select All on VF Page. I am trying this but no go

 

<apex:page standardController="Listing__c"   extensions="TFNController" id="myPage" showHeader="false">
  
 
       <apex:pageMessages id="messages"/> 
 <apex:form id="myform" >

<apex:PageBlock title="TFN Provisioning for Listing :" />
<apex:PageBlock id="pageload">
  <apex:PageBlockSection columns="1" id="theSection" > 
<apex:outputPanel style="vertical-align:top" >
  <table border="1" class="list" width="100%" cellpadding="0" cellspacing="0" id="aheadertable" >
                 <tr >  
                
                  <td width="2%"  style="font-weight:bold;text-align:center;vertical-align:bottom" rowspan='2'><b>
                    <apex:inputCheckbox id="SelectAll"   onclick="selectAll()" /></b></td>
</tr>
  </table>  
            </apex:outputPanel> 
           <apex:outputPanel style="vertical-align:top" id="test">
      <apex:repeat var="TFNAffiliate" value="{!TFNVFResults}" id="TFNAffiliateId"> 
                     <table border="0" width="100%" class="list" cellpadding="0" cellspacing="0" id="atable" >
                        <tr class="row" style="persist: location;">
                            <td width="2%" style="text-align:center" >
                             <apex:inputCheckbox id="select" value="{!TFNAffiliate.selected}" styleclass="select" /> 
                           </td>
 </table> 
                   </apex:repeat>   
                   </apex:outputPanel>    
                  </apex:PageBlockSection> 
                      </apex:PageBlock>
                           </apex:form>
<script>
function selectAll()
 {
   // var listSize = {!TFNVFResults.size};
   // alert(!TFNVFResults.size);
   // var i;
     var select;
  var selectall =  document.getElementById('{!$Component.myPage.myform.pageload.theSection.selectAll}');


  //if (selectall.checked){
  alert(selectall.value);
   
 // }
for (i = 0; i < listSize; i++) {
          
      select = document.getElementById('myPage:myform:pageload:theSection:TFNAffiliateId:'+i+':select}');
      }
 alert('test'+select.value);
 }
 </script>
   
</apex:page>

 

All

 

Here is my query

 

orderHistListRec33 = [Select Name,Account__c,Order_Status__c, Case_Number__c, Product_Description__r.Is_Package__c, Product_Description__r.Name,CreatedDate
From Order_History__c order by createdDate dsc ];

 

I get 

 

 

List is 

 

OrderHistoryNumber (Name): 123    Product_Description__r.Name:Branding    CreatdeDate : 6/25/13

OrderHistoryNumber(Name) : 124    Product_Description__r.Name:CHAT    CreatdeDate : 6/25/13

OrderHistoryNumber (Name): 125    Product_Description__r.Name:Branding   CreatdeDate : 6/22/13

OrderHistoryNumber(Name) : 126     Product_Description__r.Name:CHAT    CreatdeDate : 6/22/13

 

I want to eleiminate duplicate Product_Description__r.Name and get most recent i.e. 

 

 

OrderHistoryNumber (Name): 123    Product_Description__r.Name:Branding    CreatdeDate : 6/25/13

OrderHistoryNumber(Name) : 124    Product_Description__r.Name:CHAT    CreatdeDate : 6/25/13

 

how do i modify my query .

Is it Possible to Convert a Visualforce Page as a Image.

Hello all, 

 

I have created a sortable table using the jquery tablesort plugin and I am having trouble figuring out how to change a cell background color in the table I'm creating based on a condition.  Using <td style=background:..."  works as setting a static color, but this isn't what I need.  I am trying to get this working on the test_stat_c cells.  Since it is a number I am  trying to accomplish this condition {!IF(u.test_stat__c < 4 ,'#7CFC00', '#FFA07A')}">

 

I've tried putting it in several places inside the repeat segment, but not having any luck.  Is it even possible?  Would I have to write something into the <script> for this to work?  I need to use the tablesorter for obvious reasons.  I've tried searching around, but all I could find were resources to accomplish this using pageblock tables.

 

Thank you for your help,

 

Les

 

and the code:

 

<apex:page standardController="stat_page__c" standardstylesheets="true" sidebar="false" >
    
    <apex:stylesheet value="{!URLFOR($Resource.jquerySort, 'js/themes/blue/style.css')}"  />
    <apex:stylesheet value="{!URLFOR($Resource.jquerySort, 'css/ui-lightness/jquery-ui-1.8.6.custom.css')}"  />
    
    <script type="text/javascript" language="javascript"  src="{!URLFOR($Resource.jquerySort, 'js/jquery-latest.js')}"></script>
    <script type="text/javascript" language="javascript"  src="{!URLFOR($Resource.jquerySort, 'js/jquery.tablesorter.min.js')}"></script>


</style>

<apex:form >

<apex:sectionHeader title="for stats" />
<apex:outputPanel id="js">
      <script language="javascript" type="text/javascript">
      var j$ = jQuery.noConflict();
      
            function Loading(b){
                  if(b){
                        j$('.loadingIcon').removeClass('hideIt');
                  }else{
                        j$('.loadingIcon').addClass('hideIt');
                  }
            }
            j$(document).ready(function(){
                  j$("#tableToSort").tablesorter({
                    headers: {
                        0: {sorter: 'text'},
                        1: {sorter: 'digit'},
                        2: {sorter: 'digit'},
                        3: {sorter: 'digit'}
                    }
                });
            });   
      </script>
</apex:outputPanel>

<apex:outputPanel id="table">     
      <table id="tableToSort" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
      <thead class="rich-table-thead">
            <tr class="headerRow">
                  <th colspan="1" scope="col">Agent</th>
                  <th colspan="1" scope="col">First Break</th>
                  <th colspan="1" scope="col">Lunch Break</th>
                  <th colspan="1" scope="col">Second Break</th>
                  <th colspan="1" scope="col">test stat</th>
            </tr>
      </thead>
      <tbody>
            <apex:repeat value="{!agent_page__c.reps__r}" var="u">
            <tr class="dataRow">
                  <td><apex:outputLink value="/{!u.id}" target="_Blank">{!u.name}</apex:outputLink></td>
                  <td align="center">{!u.first_break__c}</td>
                  <td>{!u.lunch_break__c}</td>
                  <td>{!u.second_break__c}</td>
                  <td>{!u.test_stat__c}</td>          
            </tr>                                   
            </apex:repeat>
      </tbody></table>
</apex:outputPanel>

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

 

I have requirement, which is as follows..

When a user selects a particular Agent Id , all the details of that particular Agent Id should get populated on the visual force page.... I am not able to capture the selected picklist value and pass it to the Apex Controller ... Please help me..

Please guide as to where am I going wrong...

 

Class

 

public class AgentandOrderController{
Agent__c Agent;
string searchText;
List<Agent__c> result;
Integer selected;
Integer AgentId;

public String getAgent() {
        return null;
    }

 public List<Agent__c> getresult() {
      return result;
   }

public Integer getAgentId() {
return selected;
}

public void  setAgentId(Integer val) {
selected=val;
 }
 
public List<SelectOption> getItems() {
     List<SelectOption> options = new List<SelectOption>();
     options.add(new selectOption('001', '001'));
     options.add(new selectOption('002', '002'));
     options.add(new selectOption('003', '003'));
     options.add(new selectOption('004', '004'));
    
     return options;
}

public PageReference search() {
result=[select Agent_Address__c from Agent__c where Name=: ApexPages.currentPage().getParameters().get('options')];
System.debug('options : '+options);
return null;
}

}

 

 

 

Page

 

<apex:page controller="AgentandOrderController" >
 <apex:form >
<b>Agent Information</b>
  <apex:pageblock >
   <apex:pageBlockSection id="section1">
    <apex:pageBlockSectionItem >
     <apex:panelGrid columns="2">
     <apex:actionRegion >     
     <apex:outputLabel value="Agent Id" for="agentId"/>
      <apex:selectList value="{!agentId}" multiselect="false" size="1" onchange="search()" >
      <apex:selectOptions value="{!items}" />
      </apex:selectList>
     </apex:actionRegion>        
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageblock>

<b>Order Information</b>
<apex:pageBlock >
<apex:pageBlockSection id="section2">
<apex:pageBlockSectionItem >
<apex:panelGrid columns="2">
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

Thank You

I have based this code off of the VF Quote tool created by Salesforce.com Labs a couple of years back.

 

Esentially, I'm trying to take similar line items and get rid of them from the List and aggregate the quantity.  I end up with extra lines in my list for some reason.  I have a feeling it's because I'm trying to remove elements while in the loop, but I can't figure out another way to do this.

 

Any help is appreciated.

 

 

Quote_Item__c[] items = new Quote_Item__c[]{};
Quote_Item__c[] qiList = new Quote_Item__c[]{};

for(OpportunityLineItem oli:[select Maintenance_End__c, Maintenance_Start__c, quantity, unitprice, ListPrice, pricebookEntry.product2.name, pricebookEntry.product2id, pricebookEntry.product2.sort__c from opportunitylineitem where opportunityid = :opptyId order by pricebookEntry.product2.sort__c ASC]) 
{
	qiList.add(new Quote_Item__c(quantity__c = oli.quantity, unit_price__c = oli.unitprice, List_Price__c = oli.ListPrice, quote__c = renewalQuote.id, name = oli.pricebookentry.product2.name, sort__c = oli.pricebookentry.product2.sort__c, product__c = oli.pricebookentry.product2id, Maintenance_End__c = oli.Maintenance_End__c, Maintenance_Start__c=oli.Maintenance_Start__c));
}

// Iterate through working list
while(qiList.size()>0){
	Set<Id> removeAddress = new Set<Id>();
	Quote_Item__c qiTemp = qiList.get(0);
	removeAddress.add(qiTemp.Id);
	for(Quote_Item__c qi :qiList){
		If(qi.name==qiTemp.name && qi.unit_price__c==qiTemp.unit_price__c && qi.Maintenance_End__c==qiTemp.Maintenance_End__c && qi.Maintenance_Start__c==qiTemp.Maintenance_Start__c)
			{
				removeAddress.add(qi.id);
				qiTemp.Quantity__c += qi.Quantity__c;
			}
	}
	items.add(qiTemp);
	for(Id a : removeAddress){
		for(Integer i=0; i < qiList.size(); i++){
			if(a == qiList.get(i).Id)
			{
				qiList.remove(i);
			}
		}
	}
}