• Sujendran Sundarraj 8
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 13
    Replies
Hi,
We dont have an option to view documents in lightning experience. So, as a work around salesforce has mentioned to export documents using dataloader and import in files object for lightning. 
Please let me know if anyone has done it and helo me by providing steps on how to do it. 
Thank you very much in advance. 
Regards, 
Sujendran. 
In my below code I am getting error as Illegal integer.
public void refedgeAnnualrevenue(list<Account> newAccts){
        for(Account ac : newAccts){
            if(ac.AnnualRevenue >= 0 && ac.AnnualRevenue <=49999999){
                ac.RefEdge_Annual_Revenue__c ='< $50M';
            } else if(ac.AnnualRevenue >= 50000000 && ac.AnnualRevenue <=499999999){
                ac.RefEdge_Annual_Revenue__c ='$50M-$500M';
            }else if(ac.AnnualRevenue >= 500000000 && ac.AnnualRevenue <=999999999){
                ac.RefEdge_Annual_Revenue__c ='$500M - $1B';
            }else if(ac.AnnualRevenue >= 1000000000  && ac.AnnualRevenue <=4999999999){
               ac.RefEdge_Annual_Revenue__c= '$1B - $5B';
            }else if(ac.AnnualRevenue >= 5000000000){
                ac.RefEdge_Annual_Revenue__c ='> $5B';
            }
        } 
    }


at the last two if else only.
Please help to fix this issue. Thank you.
Hello, 
I have an issue with Lightning:inputfield with date datatype. I want to autopopulate the close date value i.e 90 days from today. 
to acheive this I have used $A.localicationService.formatDate(mydate);
it shows the correct date in UI but it dont set that date properly in the field. 
Any idea is appreciated. 
Thank you. 
 
Hello all, 
I have a requirement in which I need to display list of account records and each account record should hold its contact records and each contact records will also have some other information in a seperate row below. 
I want to have a collapisible buttonicon on each account records and contact reocrds. when I click account record collapisible button it should show or hide its contacts, similiarly when I click on contact's collapsible icon it should show or hide some contact below it. 
This is my sample code. 
 
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" controller="Accountcon" access="global" >
	<aura:attribute name="accounts" type="Account[]"></aura:attribute>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"></aura:handler>
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
        <tr class="slds-line-height_reset">
            <tr class="slds-truncate" ><b>Show</b></tr>
        <td class="slds-truncate" ><b>Name</b></td>               
        <td class="slds-truncate" ><b>Type</b></td>
        </tr>
        <aura:iteration items="{!v.accounts}" var="ac" indexVar="mylocIndex">
        <tr class="slds-hint-parent">
            <td> <lightning:buttonIcon value="{!mylocIndex}" iconName="{!ac.expanded?'utility:chevronright':'utility:chevrondown'}" onclick="{!c.toggle}" ></lightning:buttonIcon>
            </td>
        <td class="slds-truncate">{!ac.Name}</td>    
        <td class="slds-truncate">{!ac.Type}</td>
            </tr>
            <aura:if isTrue="{!ac.expanded}">
               <tr class="slds-line-height_reset">
                    <td class="slds-truncate" ><b>show</b></td>
            <td class="slds-truncate" ><b>Last Name</b></td>
                       
        <td class="slds-truncate" ><b>Email</b></td>
        </tr>
                    <b>Contact details</b>
            <aura:iteration items="{!ac.Contacts}" var="con">
               
               <tr class="slds-hint-parent">
                   <td> <lightning:buttonIcon value="{!mylocIndex}" iconName="{!ac.expanded?'utility:chevronright':'utility:chevrondown'}" onclick="{!c.toggle}" ></lightning:buttonIcon>
            </td>
                   <td class="slds-truncate">
                {!con.LastName}</td>
                   
                   <td class="slds-truncate">{!con.email}</td>
                </tr>
                <tr>this section should be shown or hidden onclick of collapsible button on the contact record </tr>
               </aura:iteration>
            </aura:if>
        
         </aura:iteration>
        </table>
</aura:component>




Controller.js

({
	doInit : function(component, event, helper) {
		var action = component.get("c.getacct");
        action.setCallback(this, function(action){
            component.set("v.accounts", action.getReturnValue());
        });
        $A.enqueueAction(action);
	},
     toggle :function(component, event, helper){
       
         var items = component.get("v.accounts"); 
        
        var index = event.getSource().get("v.value");
       items[index].expanded = !items[index].expanded;
       component.set("v.accounts", items);
        
        
    }
})


Apex class: 

public class AccountsController {
      @AuraEnabled
      public static List <Account> getAccounts() {
        return [SELECT Id, name, industry, Type, NumberOfEmployees, TickerSymbol, Phone, (select name, email, phone from contacts) FROM Account ORDER BY createdDate ASC limit 10];
      }
}

In my code when I click on the collapsible icon in contact it hides the entire contacts section. any help on this would be much appreciated. 
Thank you. 
Hello All, 
I  am new to Einstein Analytics, is there any way to display lenses, datasets in lightning component and download the selected dataset as Excel or CSV . Please advise.
Thank you.
Hello All, 
I am new to Einstein analytics. I have created a dashboard with a text widget at the top with welcome note and I want to display current user's name along with the welcome note. Can anyone please help to do it. 
Thank you.
Regards, 
Sujendran. 
 
Hello All, 
I have a doubt, I have a standardcontroller for case object along with an extension controller. I am getting the id from the page and trying to query the case with the same id but the query is returning null. can you please help me to clear my doubt. Below is my code. 
public  class Testclass {
public  list<case> c {get; set;}
public id caseid {get; set;}
    public Testclass(ApexPages.StandardController controller) {
caseid = apexpages.currentpage().getparameters().get('id');
system.debug(caseid);

c = [select id, casenumber,subject, account.id from case where Id =: caseid];
system.debug(c);
    }


}

​​​​​​when I put a debug statement for caseid it is showing the id
but debug statement for c is returning null. 
 
Hello All,
I am learning on Asynchronous Apex Trigger, recently introduced on summer release '19. I have created a custom object Event_testing and added it to Change Data capture and created a new trigger, that has a debug statement to capture the trigger.new values. However, The custom event trigger is not even called after the insert operation. 
Any advise would be much appreciated. 
trigger Testing_tgr1 on Event_testing__ChangeEvent (after insert) {
    for(Event_testing__ChangeEvent c : trigger.new){
        system.debug('C is '+c);
        
    }
}

Thank you.
Regards, 
Sujendran. 
​​​​​​​
Hello all, 
I am creating a heirarchical structure between account and contact using pageblocktable within another pageblocktable. I have a div tag that is holding the contacts pageblocktable for each account. On click of the account row only that perticular contact should be visiable all should hide. but when I try to get the Id of the div, it is saying as undefined. here is my code, please help!!

 
<apex:page controller="accountrecordsgetting" >
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){

$('.listener').click(function(){
var vaid = $(this).find('.valid').attr('id');
alert('id is-->'+vaid);
$('.listener').each(function(){
$('tr').css("background-color", "none");
});
$(this).closest('tr').css("background-color", "yellow");
});
});
</script>
<apex:form >

<apex:pageblock >
<apex:variable value="{!1}" var="count"/>
  <apex:pageBlockTable value="{!acts}" var="a"  >

  <apex:column value="{!a.name}" styleClass="listener" />
    <apex:column value="{!a.id}" styleClass="listener"/>
    <apex:column breakBefore="true" colspan="3" >
    <apex:variable value="{!count+1}" var="count" />
  <div id="{!Count}" style="display:none" styleClass="valid" >
    <apex:pageBlockTable value="{!a.contacts}" var="c"  >

    <apex:column value="{!c.Id}" styleclass="sublistener" />
    <apex:column value="{!c.name}" styleclass="sublistener"  />
</apex:pageBlockTable>
</div>
</apex:column>
  </apex:pageBlockTable>

  </apex:pageblock>
  </apex:form>
</apex:page><apex:page controller="accountrecordsgetting" >
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){

$('.listener').click(function(){
var vaid = $(this).find('.valid').text();
alert('id is-->'+vaid);
$('.listener').each(function(){
$('tr').css("background-color", "none");
});
$(this).closest('tr').css("background-color", "yellow");
});
});
</script>
<apex:form >

<apex:pageblock >
<apex:variable value="{!1}" var="count"/>
  <apex:pageBlockTable value="{!acts}" var="a"  >

  <apex:column value="{!a.name}" styleClass="listener" />
    <apex:column value="{!a.id}" styleClass="listener"/>
    <apex:column breakBefore="true" colspan="3" >
    <apex:variable value="{!count+1}" var="count" />
  <div id="{!Count}" style="display:none" styleClass="valid" >
    <apex:pageBlockTable value="{!a.contacts}" var="c"  >

    <apex:column value="{!c.Id}" styleclass="sublistener" />
    <apex:column value="{!c.name}" styleclass="sublistener"  />
</apex:pageBlockTable>
</div>
</apex:column>
  </apex:pageBlockTable>

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

Controller is:
public class accountrecordsgetting {
public list<account> acts{get; set;}
public accountrecordsgetting (){

acts= [select id,name, (select id,name from contacts) from account limit 10];

}

}

 
Hello Guys, 
I have a requirement, I have account pageblock table (with contact pageblock table nested inside it). when I click on  one account row, it is getting highlighted but when I click on one row inside contact table it is not highlighted. Please check the below code and advise me to fix. 



<apex:page controller="accountrecordsgetting" >
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){

$('.listener').click(function(){
$('.listener').each(function(){

$('tr').css("background-color", "none");
$('.sublistener').each(function(){
$('this').find('.sublistener').css("background-color", "none");


});

$('this').find('.sublistener').closest('tr').css("background-color", "yellow");


});
$(this).closest('tr').css("background-color", "yellow");
});


});
</script>
<apex:form >

<apex:pageblock >
  <apex:pageBlockTable value="{!acts}" var="a"  >
  
  <apex:column value="{!a.name}" styleClass="listener" />
    <apex:column value="{!a.id}" styleClass="listener"/>
    <apex:column breakBefore="true" colspan="3" >

    <apex:pageBlockTable value="{!a.contacts}" var="c" style="display: true;"  >
    <apex:column value="{!c.Id}" styleclass="sublistener" />
    <apex:column value="{!c.name}" styleclass="sublistener"  />
</apex:pageBlockTable>
</apex:column>
  </apex:pageBlockTable>
  </apex:pageblock>
  </apex:form>
</apex:page>


User-added image
Thank you.
Hello all, 
I am having a pagblock table with three picklists. based on one picklist value and text the second picklist would generate the values and based on selected second picklist value and text the third one will be generated. However, I am unable to get the correct value from that perticular column(cell). I am using jquery and it is not working as expected. Please help. below is my sample code:
<apex:page>
</apex:form>
<script>
$(document).ready(function{


});

function callfunction1(){
var value = $('.picklist1').val();
var text =$('select option:selected').text();
calldeliveryno(value, text);
}

function callfunc2();{
var value=$('.picklist2').val();
var text= $('select option:selected').text();
calllineitems(value,text);
}
function
</script>
<apex:Pageblock>
<apex:pageblocktable value="{!listrecord}" var="list">
<apex:column headervalue ="first picklist">
<apex:selectlist value="{!list.firstcolumn}" styleclass="picklist1 vareity " onchange="callfunction1();">
<apex:selectoptions value="{!forpicklist1}">
</apex:selectlist>
</apex:column>

<apex:column headervalue ="second picklist" id="column2">
<apex:selectlist value="{!list.secondcolumn}" styleclass="picklist2 vareity " onchange="callfunc2();">
<apex:selectoptions value="{!forpicklist2}">
</apex:selectlist>
</apex:column>

<apex:column headervalue ="Third picklist" id="column3">
<apex:selectlist value="{!list.thirdcolumn}">
<apex:selectoptions value="{!forpicklist3}">
</apex:selectlist>
</apex:column>



</apex:pageblocktable>


</apex:pageblock>
<apex:actionregion>
<apex:actionfunction name="calldeliveryno" action"{!passdelivery}" rerender="column2">
<apex:param name="delno" assignto="firstpicklistval" value="">
<apex:param name="delno1" assignto="firstpicklisttext" value="">
</apex:actionfunction>
</apex:actionregion>

<apex:actionregion>
<apex:actionfunction name="calllineitems" action"{!passlineitem}" rerender="column3">
<apex:param name="lineno" assignto="firstlineitemval" value="">
<apex:param name="lineno1" assignto="firstlineitemtext" value="">
</apex:actionfunction>
</apex:actionregion>

</apex:form>
<apex:page>

Thank you very much in advance.
Regards, 
Sujendran. 
 
Hi I have an requirement, that my client want me to create a report like vf page to group by the cases based on the status. the status value should be collapsable and on expanding the section it has to display the list of cases under that status. I have done half of it but still getting the issue to display the count of cases next to the status. can anyone please help me? 
my code is 

VF: 
<apex:page controller="reporttobe" showHeader="false" >
    <apex:pageBlock title="report area">
    <apex:repeat value="{!result}" var="r">
    <apex:pageBlockSection title="{!r}:Here I want to display the count of cases basec on status">

    </apex:pageblockSection>
    </apex:repeat>
    </apex:pageBlock>
</apex:page>


Controller: 
public class reporttobe {
public map<String, Decimal> result{get; set;}


list<AggregateResult> stlist;
public reporttobe(){
stlist = [select status stat, count(casenumber) caseno from case group by status];


result = new map<String, Decimal>();
for(aggregateresult aggResult: stlist){
  result.put((String)aggResult.get('stat'), (Decimal)aggResult.get('caseno'));

}
system.debug(result);

}
}


Please help. 

Thank you.
Regards, 
Sujendran. 
 
Hi, 
I have an requirement that I need to pass the value of the selectlist to my controller using jquery, I tried to get the value once it is selected from the list but it is not working. here is my code, can you please help to fix it.
<apex:page controller="selectoptionsz" >
<script type="text/javascript" src="//code.jquery.com/jquery-2.2.4.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/chosen/1.8.3/chosen.jquery.min.js"></script>


  <apex:form >
  <apex:selectList id="column1" size="1" value="{!c.Answer__c}">
  <apex:selectOptions value="{!options}" />
  
   </apex:selectList>
  </apex:form>
  <script>
$(document).ready(function(){
alert('success');
$('#column1').change(function(){
alert('test');

});
});
</script>
</apex:page>
Thank you.
regards,
Sujendran
Hello Techies, 
I have a requirement, I need to pass the value of the few <apex:inputfield> to the controller. I have written code as below, 
<apex:page docType="html-5.0" standardController="Account" extensions="ComplaintQualityController" >
   <script type="text/javascript">
    function Callmefunc()
   {
   alert('test'); 
       
   var dg = document.getElementById('{!$Component.form1.division1}').value;
       alert(dg);
   var pg = document.getElementById("{!$Component.form1.divisiongrp}").value;
       alert(pg);
   var di = document.getElementById("{!$Component.form1.dateId}").value;
       alert(di);
  Var oi=document.getElementById({!$Component.form1.ownerid}").value;   
      alert(oi);

   searchnow(dg,pg,di,oi);
   }
    
    </script>
     <apex:pageBlock >
        <apex:form id="form1" >
    <apex:actionFunction name="searchnow" action="{!search}" oncomplete="alert('called successfully');" reRender="recordsection"  >
                 <apex:param name="divparam"  value=""  />
                <apex:param name="divgrpparam" value=""  />
                <apex:param name="dateparam" value=""  />
                <apex:param name="ownerparam" value=""  />
            </apex:actionFunction>
    <ul style="list-style-type: none">
        <li>
           <span class="txt"> Division </span>
           <apex:inputField style="width:50px" id="division1" value="{!cc.GC_Division_Descr__c}"/>
        </li>
        <li>
           <span class="txt"> Product Group</span>
            <apex:inputField style="width:100px" id="divisiongrp" value="{!cc.GC_Prdt_Group_Descr__c}" />           
        </li>
       <li>
        <span class="txt">Status</span>
           <apex:selectList style="width: 150px" size="1" value="{!status}">
               <apex:selectOptions value="{!lststatus}"/>
           </apex:selectList>
        </li>
        <li>
        <span class="txt">Origin</span>
        <apex:selectList size="1" value="{!Origin}"> 
            <apex:selectOptions value="{!lstorigin}"/>
        </apex:selectList>
        </li>
        <li>
        <span class="txt">Date</span>
        <strong>    <apex:inputField id="dateId" value="{!cc.Agent_Modified_Date__c}" /></strong>
            
        </li>
        <li>
         <span class="txt">Priority</span>
            <apex:selectList size="1" value="{!priority}">
                <apex:selectOptions value="{!lstpriority}"/>
            </apex:selectList>
        </li>
        <li>
        <span class="txt">CaseRecordType</span>
            <apex:selectList style="width:100px" size="1" value="{!rectype}">
                <apex:selectOptions value="{!lstrectype}"/>
            </apex:selectList>
        </li>
        <li style="display : inline-block" >
        <span class="txt">CaseOwner</span>
           
            <strong>  <apex:inputField required="false" id="ownerid" value="{!cc.Ownerid}"/>
               
              
           
              </strong>
          
            
        </li>
        <li>
                                <apex:actionStatus id="actStatusId" >
                        <apex:facet name="start" >
                          <img src="/img/loading.gif" />                    
                        </apex:facet>
                    </apex:actionStatus>
                    &nbsp;
            <apex:commandButton value="search1" reRender="recordsection"
                                onclick="showSpinner(); Callmefunc();" oncomplete="stopspinner()" />
            

</apex:page>

On the controller side
public class ComplaintQualityController {
public string division;
public string divisiongroup;
    public string assigndate;
    public string getownerdetails;
 public ComplaintQualityController(apexpages.StandardController cont){
      recordId =apexpages.currentpage().getparameters().get('id');
        account acc = new account();
        case cc = new case();
   }
public void search(){
      
       division = Apexpages.currentPage().getParameters().get('divparam');
       divisiongroup =Apexpages.currentPage().getParameters().get('divgrpparam');
       assigndate =Apexpages.currentPage().getParameters().get('dateparam');
       getownerdetails =Apexpages.currentPage().getParameters().get('ownerparam');
          system.debug('values are 1--'+division +'2--'+divisiongroup +'3--'+assigndate+'4--'+getownerdetails );
      //  cont = null;
        //getlstcases();
        
    }
}


The page gets reloaded when ever I click search button.. Please help to fix the issue. 
Thank you in advance. 
 

Dear all, 
Kindly help me to write the test class for the below code. 
public class Workbenchlikes {
    public string strObjectName {get;set;}
    public list<SelectOption> lstObjNames {get; set;}
    public list<selectOption> lstfieldNms {get; set;}
    public list<string> getfields {get; set;} 
    public string selval {get; set;}
    public list<selectOption> selvalues {get; set;}
    public boolean test {get; set;}
    public string inputrec {get; set;}
    public workbenchlikes(){
        retriveObjectNames();
    }
    
    public void retriveObjectNames() {
        lstObjNames = new list<SelectOption>();
        lstObjNames.add(new selectOption('==Select One==', '==Select One==', false));
        map<string, schema.sobjectType> selectobjs = schema.getGlobalDescribe();
        for ( schema.sobjecttype objIterator : selectobjs.values()) {
            Schema.DescribeSObjectResult objResult = objIterator.getDescribe();
            lstObjNames.add(new SelectOption(objResult.getname(), objResult.getlabel()));
        }
               system.debug('lstObjNames ===>  '+lstObjNames);
    }
    
    public void retriveFieldNames(){
    lstfieldNms = new list<selectOption>();
    
        system.debug('strObjectName ======>  ' +strObjectName);
        
        
        schema.sobjecttype obj = schema.getglobaldescribe().get(strObjectName);
        if(obj !=null){
        Map<string, schema.sobjectField> objfield = obj.getdescribe().fields.getMap();
        for(schema.sobjectfield fiIterator : objfield.values()){
        schema.describefieldresult fieldres =fiIterator.getDescribe();
        lstfieldNms.add(new selectoption(fieldres.getname(), fieldres.getname()));
        }    
        }else{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select An Object'));
        }
       
    }
    public void clearsel(){
    if(selvalues != null){
    
     selvalues.clear();
     test = false;
     }
    }
    public void getquery(){
    selvalues = new list<selectOption>();
    if(getfields.size() == 0){
    selvalues.clear();
    }else{
    test = true;
    system.debug('test'+test);
    for(integer i=0; i< getfields.size(); i++){
selvalues .add(new selectOption(getfields[i], getfields[i]));
    }
    }
    }
    public void query(){
    map<integer,string> strl = new map<integer,string>();
    for(integer i=0 ; i<getfields.size(); i++){
    strl.put(i,getfields[i]);
    }
    system.debug('strl===>' +strl);
    inputrec = 'select '+string.join(strl.values(),',')+' from ' +strObjectName;
    }
    }

For me the code coverage is 52%. Kindly help!!

Thank you. 

Regards, 
Sujendran. 

User-added imageI have a requirement to select an object from the list and then select the required fields. Once I click query it has to generate an SOQL query for that select fields. I did it but it is coming with brackets like in the above image. Please help me to fix the issue. 

My Method is: 
  public void query(){
    map<integer,string> strl = new map<integer,string>();
    for(integer i=0 ; i<getfields.size(); i++){
    strl.put(i,getfields[i]);
    }
    system.debug('strl===>' +strl);
    inputrec = 'select   '+strl.values()+' from ' +strObjectName;
    }


Thank you in advance. 
Regards, 
Sujendran. 
 

Hi, 
I have a requirement as once the objectname is selected from the selectlistoptions it has to display all its field names. I am trying to acheive this but the actionsupport is not calling the method in action(action="{!getfieldnames}").Please help. 

VF page: 
<apex:page controller="Workbenchlike" >
<style>
td{
text-align:center;
}
</style>
<apex:form >

<div style="text-align:center;font-size:20px">

    Select from the list  :-
<apex:outputPanel >
<apex:selectList size="1" value="{!selectedobj}" >
<apex:selectOptions value="{!selectobjs}"/>
<apex:actionSupport action="{!getfieldnames}" event="onchange"  reRender="table"/>

</apex:selectList>
</apex:outputPanel>
</div>
<div style="text-align:center; font-size:15px">
<table id="table" >
<tr> 
<td>
FieldNames:<br/>
<apex:selectList ></apex:selectList>
</td>
<td>
Selected Values:<br/>
<apex:selectList ></apex:selectList>
</td>
</tr>
</table>
</div>
  </apex:form>
</apex:page>

Controller: 

public class Workbenchlike {
public string selectedobj {get; set;}
public map<string, schema.sobjectType> selectobjs {get; set;}

public workbenchlike(){
selectobjs = schema.getGlobalDescribe();
system.debug('output is'+selectobjs);
system.debug('selectedobject' +selectedobj);
}
public void getfieldnames(){
system.debug('selectedobject' +selectedobj);

}

}

Thank you. 
Regards, 

Sujendran.

Hello Guys, 
I have a requirement to export visualforce table to excel. 
I create a visualforce page with list of account records and a command button - export to excel. Once the button is clicked it will redirect to similar visualforce page with contenttype ="application/vnd.ms-excel#filename.xls". Excel file is downloading but my problem is it has to redirect to original page. 
check my code below, 

Vf page(export1): 
<apex:page controller="exportexcel"  >
<apex:pageBlock title="Records">
<apex:pageBlockTable value="{!rec}" var="r">
<apex:column value="{!r.name}"/>
<apex:column value="{!r.phone}"/>
<apex:column value="{!r.industry}"/>
<apex:column value="{!r.Type}"/>
</apex:pageBlockTable>
<apex:form >
<apex:commandButton value="export to excel" action="{!exportnow}"/>
</apex:form>
</apex:pageBlock>
</apex:page>

Controller: 
public class exportexcel {

    public PageReference exportnow() {
        pagereference pager = new pagereference('/apex/export');
        pager.setredirect(true);
        return pager;
    }


public list<account> rec {get; set;}

public exportexcel(){

rec = [select name, type, industry, phone from account limit 10];
}
}
vfpage: (export):
<apex:page controller="exportexcel" contentType="application/vnd.ms-excel#filename.xls" >
<apex:pageBlock title="Records">
<apex:pageBlockTable value="{!rec}" var="r">
<apex:column value="{!r.name}"/>
<apex:column value="{!r.phone}"/>
<apex:column value="{!r.industry}"/>
<apex:column value="{!r.Type}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Kindly help.. 
Thank you. 
 
Hello,
I am creating a simple custom login page with 2 fields username, password and a login button. 
I have created a new custom object - loginUsers to store the username and password. 
When I enter the credentials as per in that object it is not working and it is not showing any error message also. Please help me to fix this issue. 

VF: 
<apex:page controller="login" sidebar="false" showHeader="false" standardStylesheets="false">

<body style="background-image:url('{!$Resource.image}');"></body>
 <apex:form >
 
 <center style="margin-top:250px" >
 <apex:image url="{!$Resource.Nature}" width="250" height="100"/><br/>
 
 <br/>
  <apex:inputText id="Username" value="{!username}" /> <br/><br/>
 <apex:inputSecret id="password" value="{!password}"/>/><br/>

  <apex:commandButton value="login" action="{!login}"/>
  <apex:commandLink value="forgetpassword"/>

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

Apex class: 
public class login {
    
    public string username {get; set;}
    public string password {get; set;}
    public list<loginUsers__C> u =[select name,password__C from loginUsers__c where name = :username and password__c =:password];
   
   
 
    public pagereference login()
        {
        if(u.size()>0){
                 pagereference pgref = new pagereference('/apex/loginsf1');
            pgref.setredirect(true);
                 return pgref ;
        }
       
         else
         apexpages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'please enter the username and password'));

         return null;
        }
  
    
}

Thank you very much in advance. 
Regards, 
Sujendran. 
 
Hello all, 
I have a requirement in which I need to display list of account records and each account record should hold its contact records and each contact records will also have some other information in a seperate row below. 
I want to have a collapisible buttonicon on each account records and contact reocrds. when I click account record collapisible button it should show or hide its contacts, similiarly when I click on contact's collapsible icon it should show or hide some contact below it. 
This is my sample code. 
 
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" controller="Accountcon" access="global" >
	<aura:attribute name="accounts" type="Account[]"></aura:attribute>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"></aura:handler>
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
        <tr class="slds-line-height_reset">
            <tr class="slds-truncate" ><b>Show</b></tr>
        <td class="slds-truncate" ><b>Name</b></td>               
        <td class="slds-truncate" ><b>Type</b></td>
        </tr>
        <aura:iteration items="{!v.accounts}" var="ac" indexVar="mylocIndex">
        <tr class="slds-hint-parent">
            <td> <lightning:buttonIcon value="{!mylocIndex}" iconName="{!ac.expanded?'utility:chevronright':'utility:chevrondown'}" onclick="{!c.toggle}" ></lightning:buttonIcon>
            </td>
        <td class="slds-truncate">{!ac.Name}</td>    
        <td class="slds-truncate">{!ac.Type}</td>
            </tr>
            <aura:if isTrue="{!ac.expanded}">
               <tr class="slds-line-height_reset">
                    <td class="slds-truncate" ><b>show</b></td>
            <td class="slds-truncate" ><b>Last Name</b></td>
                       
        <td class="slds-truncate" ><b>Email</b></td>
        </tr>
                    <b>Contact details</b>
            <aura:iteration items="{!ac.Contacts}" var="con">
               
               <tr class="slds-hint-parent">
                   <td> <lightning:buttonIcon value="{!mylocIndex}" iconName="{!ac.expanded?'utility:chevronright':'utility:chevrondown'}" onclick="{!c.toggle}" ></lightning:buttonIcon>
            </td>
                   <td class="slds-truncate">
                {!con.LastName}</td>
                   
                   <td class="slds-truncate">{!con.email}</td>
                </tr>
                <tr>this section should be shown or hidden onclick of collapsible button on the contact record </tr>
               </aura:iteration>
            </aura:if>
        
         </aura:iteration>
        </table>
</aura:component>




Controller.js

({
	doInit : function(component, event, helper) {
		var action = component.get("c.getacct");
        action.setCallback(this, function(action){
            component.set("v.accounts", action.getReturnValue());
        });
        $A.enqueueAction(action);
	},
     toggle :function(component, event, helper){
       
         var items = component.get("v.accounts"); 
        
        var index = event.getSource().get("v.value");
       items[index].expanded = !items[index].expanded;
       component.set("v.accounts", items);
        
        
    }
})


Apex class: 

public class AccountsController {
      @AuraEnabled
      public static List <Account> getAccounts() {
        return [SELECT Id, name, industry, Type, NumberOfEmployees, TickerSymbol, Phone, (select name, email, phone from contacts) FROM Account ORDER BY createdDate ASC limit 10];
      }
}

In my code when I click on the collapsible icon in contact it hides the entire contacts section. any help on this would be much appreciated. 
Thank you. 
Hi,
We dont have an option to view documents in lightning experience. So, as a work around salesforce has mentioned to export documents using dataloader and import in files object for lightning. 
Please let me know if anyone has done it and helo me by providing steps on how to do it. 
Thank you very much in advance. 
Regards, 
Sujendran. 
Hello, 
I have an issue with Lightning:inputfield with date datatype. I want to autopopulate the close date value i.e 90 days from today. 
to acheive this I have used $A.localicationService.formatDate(mydate);
it shows the correct date in UI but it dont set that date properly in the field. 
Any idea is appreciated. 
Thank you. 
 
Hello all, 
I have a requirement in which I need to display list of account records and each account record should hold its contact records and each contact records will also have some other information in a seperate row below. 
I want to have a collapisible buttonicon on each account records and contact reocrds. when I click account record collapisible button it should show or hide its contacts, similiarly when I click on contact's collapsible icon it should show or hide some contact below it. 
This is my sample code. 
 
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" controller="Accountcon" access="global" >
	<aura:attribute name="accounts" type="Account[]"></aura:attribute>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"></aura:handler>
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
        <tr class="slds-line-height_reset">
            <tr class="slds-truncate" ><b>Show</b></tr>
        <td class="slds-truncate" ><b>Name</b></td>               
        <td class="slds-truncate" ><b>Type</b></td>
        </tr>
        <aura:iteration items="{!v.accounts}" var="ac" indexVar="mylocIndex">
        <tr class="slds-hint-parent">
            <td> <lightning:buttonIcon value="{!mylocIndex}" iconName="{!ac.expanded?'utility:chevronright':'utility:chevrondown'}" onclick="{!c.toggle}" ></lightning:buttonIcon>
            </td>
        <td class="slds-truncate">{!ac.Name}</td>    
        <td class="slds-truncate">{!ac.Type}</td>
            </tr>
            <aura:if isTrue="{!ac.expanded}">
               <tr class="slds-line-height_reset">
                    <td class="slds-truncate" ><b>show</b></td>
            <td class="slds-truncate" ><b>Last Name</b></td>
                       
        <td class="slds-truncate" ><b>Email</b></td>
        </tr>
                    <b>Contact details</b>
            <aura:iteration items="{!ac.Contacts}" var="con">
               
               <tr class="slds-hint-parent">
                   <td> <lightning:buttonIcon value="{!mylocIndex}" iconName="{!ac.expanded?'utility:chevronright':'utility:chevrondown'}" onclick="{!c.toggle}" ></lightning:buttonIcon>
            </td>
                   <td class="slds-truncate">
                {!con.LastName}</td>
                   
                   <td class="slds-truncate">{!con.email}</td>
                </tr>
                <tr>this section should be shown or hidden onclick of collapsible button on the contact record </tr>
               </aura:iteration>
            </aura:if>
        
         </aura:iteration>
        </table>
</aura:component>




Controller.js

({
	doInit : function(component, event, helper) {
		var action = component.get("c.getacct");
        action.setCallback(this, function(action){
            component.set("v.accounts", action.getReturnValue());
        });
        $A.enqueueAction(action);
	},
     toggle :function(component, event, helper){
       
         var items = component.get("v.accounts"); 
        
        var index = event.getSource().get("v.value");
       items[index].expanded = !items[index].expanded;
       component.set("v.accounts", items);
        
        
    }
})


Apex class: 

public class AccountsController {
      @AuraEnabled
      public static List <Account> getAccounts() {
        return [SELECT Id, name, industry, Type, NumberOfEmployees, TickerSymbol, Phone, (select name, email, phone from contacts) FROM Account ORDER BY createdDate ASC limit 10];
      }
}

In my code when I click on the collapsible icon in contact it hides the entire contacts section. any help on this would be much appreciated. 
Thank you. 
Hello all, 
I am creating a heirarchical structure between account and contact using pageblocktable within another pageblocktable. I have a div tag that is holding the contacts pageblocktable for each account. On click of the account row only that perticular contact should be visiable all should hide. but when I try to get the Id of the div, it is saying as undefined. here is my code, please help!!

 
<apex:page controller="accountrecordsgetting" >
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){

$('.listener').click(function(){
var vaid = $(this).find('.valid').attr('id');
alert('id is-->'+vaid);
$('.listener').each(function(){
$('tr').css("background-color", "none");
});
$(this).closest('tr').css("background-color", "yellow");
});
});
</script>
<apex:form >

<apex:pageblock >
<apex:variable value="{!1}" var="count"/>
  <apex:pageBlockTable value="{!acts}" var="a"  >

  <apex:column value="{!a.name}" styleClass="listener" />
    <apex:column value="{!a.id}" styleClass="listener"/>
    <apex:column breakBefore="true" colspan="3" >
    <apex:variable value="{!count+1}" var="count" />
  <div id="{!Count}" style="display:none" styleClass="valid" >
    <apex:pageBlockTable value="{!a.contacts}" var="c"  >

    <apex:column value="{!c.Id}" styleclass="sublistener" />
    <apex:column value="{!c.name}" styleclass="sublistener"  />
</apex:pageBlockTable>
</div>
</apex:column>
  </apex:pageBlockTable>

  </apex:pageblock>
  </apex:form>
</apex:page><apex:page controller="accountrecordsgetting" >
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){

$('.listener').click(function(){
var vaid = $(this).find('.valid').text();
alert('id is-->'+vaid);
$('.listener').each(function(){
$('tr').css("background-color", "none");
});
$(this).closest('tr').css("background-color", "yellow");
});
});
</script>
<apex:form >

<apex:pageblock >
<apex:variable value="{!1}" var="count"/>
  <apex:pageBlockTable value="{!acts}" var="a"  >

  <apex:column value="{!a.name}" styleClass="listener" />
    <apex:column value="{!a.id}" styleClass="listener"/>
    <apex:column breakBefore="true" colspan="3" >
    <apex:variable value="{!count+1}" var="count" />
  <div id="{!Count}" style="display:none" styleClass="valid" >
    <apex:pageBlockTable value="{!a.contacts}" var="c"  >

    <apex:column value="{!c.Id}" styleclass="sublistener" />
    <apex:column value="{!c.name}" styleclass="sublistener"  />
</apex:pageBlockTable>
</div>
</apex:column>
  </apex:pageBlockTable>

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

Controller is:
public class accountrecordsgetting {
public list<account> acts{get; set;}
public accountrecordsgetting (){

acts= [select id,name, (select id,name from contacts) from account limit 10];

}

}

 
Hello Guys, 
I have a requirement, I have account pageblock table (with contact pageblock table nested inside it). when I click on  one account row, it is getting highlighted but when I click on one row inside contact table it is not highlighted. Please check the below code and advise me to fix. 



<apex:page controller="accountrecordsgetting" >
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function(){

$('.listener').click(function(){
$('.listener').each(function(){

$('tr').css("background-color", "none");
$('.sublistener').each(function(){
$('this').find('.sublistener').css("background-color", "none");


});

$('this').find('.sublistener').closest('tr').css("background-color", "yellow");


});
$(this).closest('tr').css("background-color", "yellow");
});


});
</script>
<apex:form >

<apex:pageblock >
  <apex:pageBlockTable value="{!acts}" var="a"  >
  
  <apex:column value="{!a.name}" styleClass="listener" />
    <apex:column value="{!a.id}" styleClass="listener"/>
    <apex:column breakBefore="true" colspan="3" >

    <apex:pageBlockTable value="{!a.contacts}" var="c" style="display: true;"  >
    <apex:column value="{!c.Id}" styleclass="sublistener" />
    <apex:column value="{!c.name}" styleclass="sublistener"  />
</apex:pageBlockTable>
</apex:column>
  </apex:pageBlockTable>
  </apex:pageblock>
  </apex:form>
</apex:page>


User-added image
Thank you.
Hello all, 
I am having a pagblock table with three picklists. based on one picklist value and text the second picklist would generate the values and based on selected second picklist value and text the third one will be generated. However, I am unable to get the correct value from that perticular column(cell). I am using jquery and it is not working as expected. Please help. below is my sample code:
<apex:page>
</apex:form>
<script>
$(document).ready(function{


});

function callfunction1(){
var value = $('.picklist1').val();
var text =$('select option:selected').text();
calldeliveryno(value, text);
}

function callfunc2();{
var value=$('.picklist2').val();
var text= $('select option:selected').text();
calllineitems(value,text);
}
function
</script>
<apex:Pageblock>
<apex:pageblocktable value="{!listrecord}" var="list">
<apex:column headervalue ="first picklist">
<apex:selectlist value="{!list.firstcolumn}" styleclass="picklist1 vareity " onchange="callfunction1();">
<apex:selectoptions value="{!forpicklist1}">
</apex:selectlist>
</apex:column>

<apex:column headervalue ="second picklist" id="column2">
<apex:selectlist value="{!list.secondcolumn}" styleclass="picklist2 vareity " onchange="callfunc2();">
<apex:selectoptions value="{!forpicklist2}">
</apex:selectlist>
</apex:column>

<apex:column headervalue ="Third picklist" id="column3">
<apex:selectlist value="{!list.thirdcolumn}">
<apex:selectoptions value="{!forpicklist3}">
</apex:selectlist>
</apex:column>



</apex:pageblocktable>


</apex:pageblock>
<apex:actionregion>
<apex:actionfunction name="calldeliveryno" action"{!passdelivery}" rerender="column2">
<apex:param name="delno" assignto="firstpicklistval" value="">
<apex:param name="delno1" assignto="firstpicklisttext" value="">
</apex:actionfunction>
</apex:actionregion>

<apex:actionregion>
<apex:actionfunction name="calllineitems" action"{!passlineitem}" rerender="column3">
<apex:param name="lineno" assignto="firstlineitemval" value="">
<apex:param name="lineno1" assignto="firstlineitemtext" value="">
</apex:actionfunction>
</apex:actionregion>

</apex:form>
<apex:page>

Thank you very much in advance.
Regards, 
Sujendran. 
 
Hi I have an requirement, that my client want me to create a report like vf page to group by the cases based on the status. the status value should be collapsable and on expanding the section it has to display the list of cases under that status. I have done half of it but still getting the issue to display the count of cases next to the status. can anyone please help me? 
my code is 

VF: 
<apex:page controller="reporttobe" showHeader="false" >
    <apex:pageBlock title="report area">
    <apex:repeat value="{!result}" var="r">
    <apex:pageBlockSection title="{!r}:Here I want to display the count of cases basec on status">

    </apex:pageblockSection>
    </apex:repeat>
    </apex:pageBlock>
</apex:page>


Controller: 
public class reporttobe {
public map<String, Decimal> result{get; set;}


list<AggregateResult> stlist;
public reporttobe(){
stlist = [select status stat, count(casenumber) caseno from case group by status];


result = new map<String, Decimal>();
for(aggregateresult aggResult: stlist){
  result.put((String)aggResult.get('stat'), (Decimal)aggResult.get('caseno'));

}
system.debug(result);

}
}


Please help. 

Thank you.
Regards, 
Sujendran. 
 
Hi, 
I have an requirement that I need to pass the value of the selectlist to my controller using jquery, I tried to get the value once it is selected from the list but it is not working. here is my code, can you please help to fix it.
<apex:page controller="selectoptionsz" >
<script type="text/javascript" src="//code.jquery.com/jquery-2.2.4.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/chosen/1.8.3/chosen.jquery.min.js"></script>


  <apex:form >
  <apex:selectList id="column1" size="1" value="{!c.Answer__c}">
  <apex:selectOptions value="{!options}" />
  
   </apex:selectList>
  </apex:form>
  <script>
$(document).ready(function(){
alert('success');
$('#column1').change(function(){
alert('test');

});
});
</script>
</apex:page>
Thank you.
regards,
Sujendran
User-added imageI have a requirement to select an object from the list and then select the required fields. Once I click query it has to generate an SOQL query for that select fields. I did it but it is coming with brackets like in the above image. Please help me to fix the issue. 

My Method is: 
  public void query(){
    map<integer,string> strl = new map<integer,string>();
    for(integer i=0 ; i<getfields.size(); i++){
    strl.put(i,getfields[i]);
    }
    system.debug('strl===>' +strl);
    inputrec = 'select   '+strl.values()+' from ' +strObjectName;
    }


Thank you in advance. 
Regards, 
Sujendran. 
 

Hi, 
I have a requirement as once the objectname is selected from the selectlistoptions it has to display all its field names. I am trying to acheive this but the actionsupport is not calling the method in action(action="{!getfieldnames}").Please help. 

VF page: 
<apex:page controller="Workbenchlike" >
<style>
td{
text-align:center;
}
</style>
<apex:form >

<div style="text-align:center;font-size:20px">

    Select from the list  :-
<apex:outputPanel >
<apex:selectList size="1" value="{!selectedobj}" >
<apex:selectOptions value="{!selectobjs}"/>
<apex:actionSupport action="{!getfieldnames}" event="onchange"  reRender="table"/>

</apex:selectList>
</apex:outputPanel>
</div>
<div style="text-align:center; font-size:15px">
<table id="table" >
<tr> 
<td>
FieldNames:<br/>
<apex:selectList ></apex:selectList>
</td>
<td>
Selected Values:<br/>
<apex:selectList ></apex:selectList>
</td>
</tr>
</table>
</div>
  </apex:form>
</apex:page>

Controller: 

public class Workbenchlike {
public string selectedobj {get; set;}
public map<string, schema.sobjectType> selectobjs {get; set;}

public workbenchlike(){
selectobjs = schema.getGlobalDescribe();
system.debug('output is'+selectobjs);
system.debug('selectedobject' +selectedobj);
}
public void getfieldnames(){
system.debug('selectedobject' +selectedobj);

}

}

Thank you. 
Regards, 

Sujendran.

Hello,
I am creating a simple custom login page with 2 fields username, password and a login button. 
I have created a new custom object - loginUsers to store the username and password. 
When I enter the credentials as per in that object it is not working and it is not showing any error message also. Please help me to fix this issue. 

VF: 
<apex:page controller="login" sidebar="false" showHeader="false" standardStylesheets="false">

<body style="background-image:url('{!$Resource.image}');"></body>
 <apex:form >
 
 <center style="margin-top:250px" >
 <apex:image url="{!$Resource.Nature}" width="250" height="100"/><br/>
 
 <br/>
  <apex:inputText id="Username" value="{!username}" /> <br/><br/>
 <apex:inputSecret id="password" value="{!password}"/>/><br/>

  <apex:commandButton value="login" action="{!login}"/>
  <apex:commandLink value="forgetpassword"/>

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

Apex class: 
public class login {
    
    public string username {get; set;}
    public string password {get; set;}
    public list<loginUsers__C> u =[select name,password__C from loginUsers__c where name = :username and password__c =:password];
   
   
 
    public pagereference login()
        {
        if(u.size()>0){
                 pagereference pgref = new pagereference('/apex/loginsf1');
            pgref.setredirect(true);
                 return pgref ;
        }
       
         else
         apexpages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'please enter the username and password'));

         return null;
        }
  
    
}

Thank you very much in advance. 
Regards, 
Sujendran.