• Money Care 7
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 38
    Questions
  • 27
    Replies
Hi Guys

I have created 3 vf page based on lead object field.i am able to insert 1st page when i am inserting record in 2nd page its not working.how to upsert record in my page ...
Hi All
I am facing one issue for long time.i have a standard object (Lead) and having standard and custon field.i have created a 4 Vf pages based on lead field ie leadpage1,leadpage2,leadpage3,leadpage4.when i am entering leadpage1 and click save it is saving and goes to leadpage2,if i am entring details in leadpage2 and click save it should be upsert .but it is not working.
public class Upsert1
{
    public Lead leadRec{get; set;}
    public Upsert1()
    {
        leadRec= new Lead();
    }
    
    public PageReference cancel() 
    {
        return null;
    }


    public PageReference save() 
    {
        return null;
    }

    
    public void saveAndContinue()
    {
    
        upsert leadRec Lead.Fields.Lead_No_new__c;
        
    }
}
<apex:pageblocksection title=" Information" showheader="true" columns="2">
                  <apex:inputfield value="{!leadRec.Entry_By__c}" />
                  <apex:inputfield value="{!leadRec.Campaign_If_any__c}" />
                   <apex:inputfield value="{!leadRec.Lead_Status__c}" />
                     <apex:inputfield value="{!leadRec.Lead_Type__c}" />
                  
                      <apex:inputfield value="{!leadRec.Nationality__c}" />
                      
                        <apex:inputfield value="{!leadRec.Age_Group__c}" />
                       
                             <apex:inputfield value="{!leadRec.Residency_Status__c}" />
                               <apex:inputfield value="{!leadRec.Religion__c}" />
                                 <apex:inputfield value="{!leadRec.Gender__c}" />

  </apex:pageblocksection>


 
Hi have develop a vf page for lead object to display and search record dynamically.but problem is record is not displaying .
<apex:page sidebar="false" standardController="lead" recordSetVar="items">
<apex:form >



    <apex:composition template="DhamaniTemplate" >
        <apex:define name="title">
            Leads
        </apex:define>
        <apex:define name="content">
            <style>
                 .es-wws-lead{
                     background:transparent url("{!URLFOR($Resource.Resource,'Resources/css/img/leads-hover.png')}") no-repeat -1px -1px;
                }
                .es-wws-lead-active{
                    background-color:#079FD0;
                    color:#fff;
                    border-color:#079FD0;
                }
            </style>
            
             <div ng-app="myApp">
                <div ng-controller="customersCtrl" ng-init="showData()">
                    <div class="es-wws-filters">
                        <input type="text" placeholder="Search" ng-model="query" class="es-wws-search" ng-keyup="showData()"/>
                        <div class="es-wws-filter-float-right">
                            <label for="es-wws-records" class="es-wws-select-records-label">Records per page :&nbsp;</label>
                            <select id="es-wws-records" class="es-wws-select-records" 
                                ng-options="option.name for option in recordsPerpage.availableOptions track by option.id"
                                ng-model="recordsPerpage.selectedOption" ng-change="showData()">
                            </select>
                            <a href="/00Q/e" target="_blank" class="es-wws-add"></a>
                            <button ng-click="massdelete()" class="ess-wws-delete"></button>
                        </div>
                    </div>
                    <div class="es-wws-table-container">
                        <table class="es-wws-table">
                            <thead>
                                <tr class="es-wws-table-header-row">
                                    <td class="es-wws-table-action"><input type="checkbox" ng-model="selAll" ng-click="chval()"/></td>
                                    <td class="es-wws-table-name" ng-click="orderByMe('Name')"><span>Name &nbsp;</span> <span class="sortorder" ng-show="predicate === 'Name'" ng-class="{reverse:reverse}"></span></td>
                                    <td ng-click="orderByMe('Industry')"><span>Industry &nbsp;</span> <span class="sortorder" ng-show="predicate === 'Industry'" ng-class="{reverse:reverse}"></span></td>
                                    <td ng-click="orderByMe('Phone')"><span>Phone &nbsp;</span> <span class="sortorder" ng-show="predicate === 'Phone'" ng-class="{reverse:reverse}"></span></td>
                                    <td ng-click="orderByMe('leadSource')"><span>Lead Source  &nbsp;</span><span class="sortorder" ng-show="predicate === 'leadSource'" ng-class="{reverse:reverse}"></span></td>
                                    <td ng-click="orderByMe('Company')"><span>Company  &nbsp;</span><span class="sortorder" ng-show="predicate === 'Company'" ng-class="{reverse:reverse}"></span></td>
                                    <td ng-click="orderByMe('Status')"><span>Lead status &nbsp;</span> <span class="sortorder" ng-show="predicate === 'Status'" ng-class="{reverse:reverse}"></span></td>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="items" ng-repeat="x in (filtered=(allrec=(names |filter:query)| pagination: curPage * pageSize | limitTo: pageSize))">
                                    <td><input type="checkbox" ng-model="x.selected"/></td>
                                    <td><a href="/{{x.ID}}" target="_blank">{{x.Name}}</a></td>
                                    <td>{{x.Industry}}</td>
                                    <td>{{x.Phone}}</td>
                                    <td>{{x.leadSource}}</td>
                                    <td>{{x.Company}}</td>
                                    <td>{{x.Status}}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="es-wws-no-record-warning" ng-show="filtered.length==0">
                        <span> No Records Returned</span>           
                    </div>
                    <div class="es-wws-table-footer">
                        <ul class="es-wws-pagination-list" ng-show="filtered.length>0">
                            <li>
                                <button type="button" class="es-wws-prev es-wws-nav-btn" ng-disabled="curPage == 0" ng-click="pageChange('p')"></button>
                            </li>
                            <li>
                                <span>Page {{curPage + 1}} of {{ numberOfPages() }}</span>  
                            </li>
                            <li>
                            <button type="button" class="es-wws-nav-btn" ng-disabled="curPage >= allrec.length/pageSize - 1" ng-click="pageChange('n')"></button>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <script>
                   
                    var app = angular.module('myApp', []);
                    app.controller('customersCtrl',function($scope, $filter) {
                    $scope.recordsPerpage={"availableOptions":[{"id":5,"name":"5"},{"id":10, "name":"10"},{"id":20, "name":"20"},{"id":50, "name":"50"},{"id":100, "name":"100"},{"id":1000, "name":"1000"}],"selectedOption":{"id": 10,"name":"10"}};
                        $scope.showData = function( ){
                            $scope.curPage = 0;
                            $scope.pageSize = $scope.recordsPerpage.selectedOption.id;
                            
                            $scope.numberOfPages = function() {
                                return Math.ceil($scope.allrec.length / $scope.pageSize);
                            };
                        };
                        var orderBy = $filter('orderBy');
                            $scope.orderByMe = function(predicate) {
                                $scope.predicate = predicate;
                                $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
                                $scope.names = orderBy($scope.names, predicate, $scope.reverse);
                            };
                        $scope.orderByMe('Name',true);
                        $scope.massdelete=function(){
                                document.getElementById("es-modal").style.display="block";
                                document.getElementById("es-pop").style.display="block";
                                var data=angular.toJson($scope.filtered, true);
                                lead.processdelete(data, function(result,event){
                                document.getElementById("es-modal").style.display="none";
                                document.getElementById("es-pop").style.display="none";
                                    if(event.status){
                                        if(result=='success')
                                                window.location.reload();
                                        else
                                            
                                            document.getElementById("es-wws-warn").innerHTML ='<div class="es-wws-error">'+result+'</div>';
                                    }
                                    else if (event.type === 'exception') {
                                        document.getElementById("es-wws-warn").innerHTML ='<div class="es-wws-error">'+event.message+'</div>';
                                        
                                    } else {
                                        $scope.showVal=false;
                                       document.getElementById("es-wws-warn").innerHTML ='<div class="es-wws-error">'+event.message+'</div>';
                                    }
                                        
                                });
                        };
                        
                        $scope.chval=function(){
                            for(var i=0;i<$scope.filtered.length;i++){
                                $scope.filtered[i].selected=$scope.selAll;
                            }
                        };
                         $scope.pageChange=function(d){
                            $scope.selAll=false;
                            for(var i=0;i<$scope.names.length;i++){
                                $scope.names[i].selected=$scope.selAll;
                            }
                            if(d=='p')
                                $scope.curPage-=1;
                            if(d=='n')
                                $scope.curPage+=1;
                        };
                        
                });
        
                angular.module('myApp').filter('pagination', function(){
                    return function(input, start)
                    {
                        start = +start;
                        return input.slice(start);
                    };
                });
            </script>
            </apex:define>
             </apex:composition>
    </apex:form>
            
            
        
   
</apex:page>

 
Hi All

How to create custom lighting component for upcoming Birth Day.
Hi All

I have created a vf page and class for display record based on piclist value.i have written test class for this but its code covrage is 23%.how to improve this code coverage
<apex:page controller="displaylead" sidebar="false" showHeader="false">
    <apex:form id="frm">
        <apex:selectList size="1" value="{!getcasetype}" >
            <apex:selectOptions value="{!casestatus}"> </apex:selectOptions>
            <apex:actionSupport event="onchange" action="{!displaycaselist}"/>
        </apex:selectList>
        <apex:outputLabel id="pnl1" >
            <apex:pageBlock >
                <apex:pageBlockTable value="{!caselst}" var="cse">
                    <apex:column value="{!cse.Name}"/>
                    <apex:column value="{!cse.Company}"/>
                    <apex:column value="{!cse.Phone}"/>
                    <apex:column value="{!cse.Title}"/>
                  
                    <apex:column value="{!cse.Email}"/>
                 
                    <apex:column value="{!cse.LeadSource}"/>
                    <apex:column value="{!cse.Status}"/>
                    <apex:column value="{!cse.Catagory__c }"/>
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:outputLabel>
    </apex:form>
</apex:page>
 
public class displaylead {
    public string getcasetype{get;set;}
    public  void displaylead (){

    }
    public list<Lead> caselst{get;set;}
    public list<selectoption>getcasestatus(){
        list<selectoption>selectopt=new list<selectoption>();
        selectopt.add(new selectoption('Corporate','Corporate'));
        selectopt.add(new selectoption('Government','Government'));
        
        selectopt.add(new selectoption('Nonprofit','Nonprofit'));
        selectopt.add(new selectoption('Foundation','Foundation'));
        selectopt.add(new selectoption('Nonprofit','Nonprofit'));
        selectopt.add(new selectoption('NKC Member','NKC Member'));
        selectopt.add(new selectoption('WildTeam Staff','WildTeam Staff'));
        selectopt.add(new selectoption('Individual','Individual'));
        selectopt.add(new selectoption('Media','Media'));
          selectopt.add(new selectoption('Donor','Donor'));
            selectopt.add(new selectoption('FMCG','FMCG'));
              selectopt.add(new selectoption('Others','Others'));
        return selectopt;
    }
 public void displaycaselist(){
        caselst=new list<Lead>();
        caselst=[SELECT Name,Company,Phone, Title,Email,LeadSource,Status,Catagory__c from Lead where Catagory__c=:getcasetype];
    }
   
}
@isTest 
public class displayleadTest 
{
    static testMethod void displayleadT() 
    {
        List<Lead> lstPattern = new List<Lead>();
        Lead p1 = new Lead();
        
       p1.Company='Test Patttern';
       p1.Catagory__c = 'xxxx';
       p1.Title='sfdc';
       p1.Email='sfdc@abc.com';
       p1.LeadSource='sfdc';
       p1.Status='sfdc';
       insert lstPattern;
        
        displaylead gp = new displaylead();
       gp.displaycaselist();
      
 PageReference pageref = Page.displaylead;
  Test.setCurrentPageReference(pageref);
       
    }
 
}


 
Hi Guys

I have created a controller for mail sending.how to write test class for this
public class CheckBoxEmailAssignmentPage{

    public CheckBoxEmailAssignmentPage(ApexPages.StandardController controller) {
    
    addresses = new List<String>();
        integer  i =0;
        allContacts = [SELECT id, FirstName,LastName, email from Contact];
        modelList = new List<ContactModel>();
        for(Contact con :allContacts){
        if(con.Email!=null){
            ContactModel cm = new ContactModel();
            cm.srno = ++i;
            cm.con = con;
            modelList.add(cm);
            }
        }
    }

    

    public List<Contact> allContacts{get;set;}
    public List<ContactModel> modelList{get;set;}
    public string to{get;set;}
    public List<string> addresses{get;set;}
    public String fromAdd{set;get;}
    public String body{set;get;}
    public String subject{get;set;}
    public CheckBoxEmailAssignmentPage(){
        addresses = new List<String>();
        integer  i =0;
        allContacts = [SELECT id, FirstName,LastName, email from Contact];
        modelList = new List<ContactModel>();
        for(Contact con :allContacts){
        if(con.Email!=null){
            ContactModel cm = new ContactModel();
            cm.srno = ++i;
            cm.con = con;
            modelList.add(cm);
            }
        }
    }
    public void sendEmail(){
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        addresses = to.split(',');
        email.setInReplyTo(fromAdd);
        email.setSubject(subject);
        email.setToAddresses(addresses);
        email.setPlainTextBody(body);
        emails.add(email);
        Messaging.sendEmail(emails);
    } 
    public class ContactModel{
        public Integer srno{get;set;}
        public Contact con{set;get;}
        public String text{get;set;}   
        public ContactModel(){
            srno = 0;
            con = new Contact();
        }
    }
}
<apex:page id="pg" standardController="contact" extensions="CheckBoxEmailAssignmentPage">
    <apex:form id="frm">
     <apex:actionStatus id="st" startText="Email Sending....." startStyle="color:red"></apex:actionStatus>
        <script>
            function checkAll(cb,cbid){
                var inputElem = document.getElementsByTagName("input");
                if(inputElem.id != 'pg:frm:pb:pbt:allcheck'){
                for(var i=0; i<inputElem.length; i++){
                    if(inputElem[i].id.indexOf(cbid)!=-1){
                        inputElem[i].checked = cb.checked;
                    }
                }
                }
            }
            function selectedContacts(){
                var divObj = document.getElementById("contacts");
                var inputs = divObj.getElementsByTagName("input");
                var emails = '';
                var comma = "";
                if(inputs.length > 0 ){
                    for(i=0; i<inputs.length; i++){
                        if(inputs[i].type == "checkbox" && inputs[i].checked && inputs[i].id != 'pg:frm:pb:pbt:allcheck'){
       
                            emails += comma + inputs[i].value;
                            comma = ",";
                        }
                    }
                }
                 document.getElementById('pg:frm:pbs:pbs1:to').value=emails;
                 document.getElementById('pg:frm:pbs:pbs1:to1').value=emails;
            }
        </script>  
        <apex:pageBlock title="All Contacts" id="pb">
        <apex:actionFunction name="sendEmail" action="{!sendEmail}" reRender="frm" status="st"/>
        <apex:pageBlockButtons >
            <apex:commandButton value="Send" onclick="sendEmail();return false;"/>
        </apex:pageBlockButtons>
       <div style="width:500px;margin:0px auto 0px auto;background-color:White;border: 1px solid black;" id="contacts">
            <apex:pageBlockTable value="{!modelList}" var="mCon" id="pbt">
                <apex:column headerValue="Srno" value="{!mCon.srno}"/>
                <apex:column >
                    <apex:facet name="header">
                        <apex:inputCheckbox onclick="checkAll(this,'chk')" id="allcheck" onchange="selectedContacts()"/>
                        </apex:facet>                
                    <input type="checkbox" id="chk" value="{!mCon.con.email}" onclick="selectedContacts()"/>
                </apex:column>
                <apex:column headerValue="First Name" value="{!mCon.con.FirstName}"/>
                <apex:column headerValue="Last Name" value="{!mCon.con.LastName}"/>
                <apex:column value="{!mCon.con.Email}"/>
            </apex:pageBlockTable> 
        </div>         
        </apex:pageBlock>
        <div style="width:200px;margin:0px auto 0px auto;background-color:White;border: 1px solid black;">
        <apex:pageBlock id="pbs" rendered="true">
           <apex:pageBlockSection id="pbs1">
                <apex:outputLabel > <b>From :</b>
                <apex:inputText value="{!fromAdd}"/></apex:outputLabel><br/>
                <apex:outputLabel ><b>To :</b> 
                <apex:inputText value="{!to}" id="to"/></apex:outputLabel>
                <apex:outputText value="{!to}" id="to1"/>
                <apex:outputLabel ><b>Subject :</b> </apex:outputLabel><br/>
                <apex:inputText value="{!subject}"/><br/>
                <apex:outputLabel ><b>Message : </b></apex:outputLabel><br/>
                <apex:inputTextarea value="{!body}" rows="1"/ >
               
            </apex:pageBlockSection>
        </apex:pageblock>
        </div>
    </apex:form>
</apex:page>


 
Hi guys

I want to create a custom lead convert page uisng vf page.i have standard lead convert procedd but that is not fit for my requirmnet.can anyone provide or share sample code for which i can i achieve my goal.


Thanks
 
Hi Guys

I have created a custom domain in production org.but now i want to delete that one.but when i am going to delete ,the delete option is showing invisible.can anybody tell me how to delete my domain name.
Hi All

I am the system admin .i have 5 user including me.but problem is when i am creating record other user not able to see.now the all  are public .so why it is not happening?
Hi All

I have created a script for cmd data loader ,it working before fine.but now it si not working .its showing error like
C:\Program Files (x86)\salesforce.com\Data Loader\bin>process.bat "D:\Test" Invo
iceUpsert
2016-09-10 13:53:18,455 INFO  [main] controller.Controller initLog (Controller.j
ava:389) - Using built-in logging configuration, no log-conf.xml in C:\Program F
iles (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2016-09-10 13:53:18,467 INFO  [main] controller.Controller initLog (Controller.j
ava:391) - The log has been initialized
2016-09-10 13:53:18,473 INFO  [main] process.ProcessConfig getBeanFactory (Proce
ssConfig.java:103) - Loading process configuration from config file: D:\Test\pro
cess-conf.xml
2016-09-10 13:53:18,649 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinit
ions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file
 [D:\Test\process-conf.xml]
2016-09-10 13:53:18,776 INFO  [InvoiceUpsert] controller.Controller initConfig (
Controller.java:327) - config dir created at D:\Test
2016-09-10 13:53:18,793 INFO  [InvoiceUpsert] controller.Controller initConfig (
Controller.java:355) - The controller config has been initialized
2016-09-10 13:53:18,796 INFO  [InvoiceUpsert] process.ProcessRunner run (Process
Runner.java:116) - Initializing process engine
2016-09-10 13:53:18,797 INFO  [InvoiceUpsert] process.ProcessRunner run (Process
Runner.java:119) - Loading parameters
2016-09-10 13:53:19,665 INFO  [InvoiceUpsert] config.LastRun load (LastRun.java:
96) - Last run info will be saved in file: D:\Test\InvoiceUpsert_lastRun.propert
ies
2016-09-10 13:53:19,686 FATAL [main] process.ProcessRunner topLevelError (Proces
sRunner.java:238) - Unable to run process InvoiceUpsert
java.lang.RuntimeException: com.salesforce.dataloader.exception.ProcessInitializ
ationException: Error creating file: D:\InvoiceUpsertSucess.csv
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:162)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:100)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:253)
Caused by: com.salesforce.dataloader.exception.ProcessInitializationException: E
rror creating file: D:\InvoiceUpsertSucess.csv
        at com.salesforce.dataloader.controller.Controller.setStatusFiles(Contro
ller.java:486)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:124)
        ... 2 more
Caused by: java.io.IOException: Error creating file: D:\InvoiceUpsertSucess.csv
        at com.salesforce.dataloader.controller.Controller.validateFile(Controll
er.java:506)
        at com.salesforce.dataloader.controller.Controller.setStatusFiles(Contro
ller.java:483)
        ... 3 more
C:\Program Files (x86)\salesforce.com\Data Loader\bin>

 
Hi All,
We are getting started with a project from the scratch. Hence we are looking for the templates of the Following documents. If anyone can share a template it will be of great help. The template is required for 1.Requirement Gathering, 2. Functional Specification, 3. Technical Specifications.
Thanks in Advance.
 
 
Hi Friend

How to send newsletter mail uisng mailchip in salesforce organization.can anyone help me on this job...


Thanks in Adv.
Hi Guys

How to send newsletter mail uisng vf page .
Hi All

I have one requirment to add two number.I have created three text field ,two is for number and one is for mathematical operator.when i am entering number and and enter add symbole,the it will be display result.how it is possible

User-added image
Hi Guys
How to update account field when i am updating contact field uisng trigger.

For expamle:

account and contact object have mail _id__c custom field if i will update contact mail_id__c field then that will be updated in account object automatically..
Hi Guys
I have created a Vf page like
<b>Start Date</b><apex:inputField value="{!j.From_Date__c}"  />&nbsp;&nbsp;&nbsp;
     <b>End Date</b><apex:inputField value="{!j.To_Date__c}" />
     <apex:commandButton value="Go" action="{!displaingTable}" style="background:green"/>
      <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
User-added image

but i am making mandatory the date field using required="true"
<b>Start Date</b><apex:inputField value="{!j.From_Date__c}"  required="true"/>&nbsp;&nbsp;&nbsp;
     <b>End Date</b><apex:inputField value="{!j.To_Date__c}" required="true"/>
     <apex:commandButton value="Go" action="{!displaingTable}" style="background:green"/>
      <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
User-added image

so how to arrange the field in same line when i am using required field...
 
Hi All I am getting error when i am deleting the record like

Visualforce Error
Help for this Page
System.LimitException: Too many SOQL queries: 101
Error is in expression '{!deleteAll}' in component <apex:commandButton> in page dynamicsearch: Trigger.DuplicatePreventer: line 20, column 1
Trigger.DuplicatePreventer: line 20, column 1

 
trigger DuplicatePreventer on MasterTest__c (before insert, before update) {
        
        Map<String, MasterTest__c> cbkUserMap = new Map<String, MasterTest__c>();

      
        for (MasterTest__c cbkUser : System.Trigger.new) {

            if ((cbkUser.Name != null) && (System.Trigger.isInsert ||
 (cbkUser.Name != System.Trigger.oldMap.get(cbkUser.Id).Name))) {

                
                if (cbkUserMap.containsKey(cbkUser.Name)) {
                    cbkUser.Name.addError('Another new MasterTest__c has the same MASTER_CODE.');
                } else {
                    cbkUserMap.put(cbkUser.Name, cbkUser);
                }
            }
        }
      

        for (MasterTest__c cbkUser :[SELECT Name FROM MasterTest__c WHERE Name IN :cbkUserMap.KeySet()]) {
           MasterTest__c newCbkUser = cbkUserMap.get(cbkUser.Name);
            newCbkUser.Name.addError('A MasterTest__c with this MATSER_CODE already exists.');
        }
    }

 
Hi Guys

I am facing this issue now when i am calling class uisng javascript like 

Error: Function REQUIRESCRIPT may not be used in this type of formula
 
global class SendTigerTuesday
{
public static blob b;
    
    WebService static string Tuesday(string id)
    {
     try
     {
              
          TigerTuesday__c qt=[Select id,Mail_Id__c,CreatedBy.name,Name, Issue_Date__c,Issue__c from TigerTuesday__c where id=:id];
        
        
            PageReference pdf =new PageReference('/apex/TigerTuesDayPDF?scontrolCaching=1&id='+Id);
            
            pdf.setRedirect(true);
           
          if(Test.isRunningTest() == false){
       b = pdf.getContent();
}
        
        //--------create a mail object to send a single email.--------
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         
         string[] toaddress =String.valueOf(qt.Mail_Id__c).Split(',');

            mail.setToAddresses(toaddress);
          //  mail.setToAddresses(new string[] {qt.email__c}); // Internal_Email_User_Id__c text fied
          
            mail.setBccAddresses(new String[] {'maheswar@globalnest.com'});
            mail.setBccSender(true);
          
        
            mail.setSenderDisplayName(qt.CreatedBy.name);
            
           
            //mail.setSubject('News Flash For'+' '+qt.Company_Name__c);
            mail.setSubject('TigerTuesDay,'+' '+'Issue'+' '+qt.Issue__c +' '+'Dated '+' '+qt.Issue_Date__c);
            
        //------------- Create the email attachment-----------------
         
            
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('TigerTuesDay.pdf');
            efa.setBody(b);
        //-----------------------------------------------------------
            mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            //mail.setPlainTextBody('Hi Sir/Madam, Please find the News Flash for '+qt.Company_Name__c +'\n'+'\n'+'Thanks & Regards'+'\n'+qt.CreatedBy.name);
      mail.setPlainTextBody('Dear Tiger Friend ,' + '\n' + '\n' + 'USAID’s Bagh Activity would like to share its weekly bulletin- TigerTuesday,'+' '+'Issue'+' '+qt.Issue__c +' '+'Dated '+' '+qt.Issue_Date__c+'.'+'\n'+'\n'+'Thanks & Regards'+'\n'+'\n'+qt.CreatedBy.name);
       
        //------------------------Attach sales order to a contract--------------------
         Attachment formAttach = new Attachment();
         formAttach.Name = 'TigerTuesday'+qt.Name+'.pdf';
         formAttach.body = b;
         formAttach.ContentType='application/pdf';
         formAttach.parentId =id;
         if (!Test.isRunningTest())
         {
          
           insert formAttach;
         }
        
            //send the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail } );
           
            return 'TigerTuesDay PDF  has been sent';
        }
        catch(exception ex)
        {
           
          string ex1=string.valueof(ex);
          return ex1;
            
        }

    }
    
}
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

var msg =sforce.apex.execute("SendTigerTuesday","Tuesday", {id:"{!TigerTuesday__c.Id}"}); 
window.alert(msg); 
window.location.href=location.href;


 
Hi All

How to overcome salesforce limitation System.LimitException: Too many SOQL queries: 101

 
List<MasterCopy__c> masterCopyList = new List<MasterCopy__c>([Select Name,DateUpdate__c, Opening_Balance__c, Closing_Balance__c, Master_Code__c, Master_Name__c from MasterCopy__c]);
    List<MasterCopy__c> upsertMasterList = new List<MasterCopy__c>();
    MasterCopy__c masterCopyInsert;
    List<MasterTest__c> masterTestList = new List<MasterTest__c>([Select Date__c, Opening_Balance__c, Master_Code__c, Name, Closing_Balance__c from MasterTest__c]);
    if(trigger.isBefore && trigger.isInsert  ){
        for(MasterTest__c masterTest : trigger.new){
            masterTest.EntryDate__c = masterTest.Date__c;
            masterTest.To_Date__c = masterTest.Date__c;
            masterTest.From_Date__c = masterTest.Date__c;
            
            
            masterTest.Closing_Balance__c = masterTest.Opening_Balance__c;
        }
    }

 
Hi I have created a custom button to call apex class but it is showing error like

Error: Function REQUIRESCRIPT may not be used in this type of formula

Error: Enter a URL that is valid and well-formed

 
{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")} 
var msg =sforce.apex.execute("SendTigerTuesday","Tuesday", {id:"{!TigerTuesday__c.Id}"}); 
window.alert(msg); 
window.location.href=location.href;

 
Hi guys

I want to create a custom lead convert page uisng vf page.i have standard lead convert procedd but that is not fit for my requirmnet.can anyone provide or share sample code for which i can i achieve my goal.


Thanks
 
Hi All

I have one requirment to add two number.I have created three text field ,two is for number and one is for mathematical operator.when i am entering number and and enter add symbole,the it will be display result.how it is possible

User-added image
Hi Guys

I am facing this issue now when i am calling class uisng javascript like 

Error: Function REQUIRESCRIPT may not be used in this type of formula
 
global class SendTigerTuesday
{
public static blob b;
    
    WebService static string Tuesday(string id)
    {
     try
     {
              
          TigerTuesday__c qt=[Select id,Mail_Id__c,CreatedBy.name,Name, Issue_Date__c,Issue__c from TigerTuesday__c where id=:id];
        
        
            PageReference pdf =new PageReference('/apex/TigerTuesDayPDF?scontrolCaching=1&id='+Id);
            
            pdf.setRedirect(true);
           
          if(Test.isRunningTest() == false){
       b = pdf.getContent();
}
        
        //--------create a mail object to send a single email.--------
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         
         string[] toaddress =String.valueOf(qt.Mail_Id__c).Split(',');

            mail.setToAddresses(toaddress);
          //  mail.setToAddresses(new string[] {qt.email__c}); // Internal_Email_User_Id__c text fied
          
            mail.setBccAddresses(new String[] {'maheswar@globalnest.com'});
            mail.setBccSender(true);
          
        
            mail.setSenderDisplayName(qt.CreatedBy.name);
            
           
            //mail.setSubject('News Flash For'+' '+qt.Company_Name__c);
            mail.setSubject('TigerTuesDay,'+' '+'Issue'+' '+qt.Issue__c +' '+'Dated '+' '+qt.Issue_Date__c);
            
        //------------- Create the email attachment-----------------
         
            
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('TigerTuesDay.pdf');
            efa.setBody(b);
        //-----------------------------------------------------------
            mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            //mail.setPlainTextBody('Hi Sir/Madam, Please find the News Flash for '+qt.Company_Name__c +'\n'+'\n'+'Thanks & Regards'+'\n'+qt.CreatedBy.name);
      mail.setPlainTextBody('Dear Tiger Friend ,' + '\n' + '\n' + 'USAID’s Bagh Activity would like to share its weekly bulletin- TigerTuesday,'+' '+'Issue'+' '+qt.Issue__c +' '+'Dated '+' '+qt.Issue_Date__c+'.'+'\n'+'\n'+'Thanks & Regards'+'\n'+'\n'+qt.CreatedBy.name);
       
        //------------------------Attach sales order to a contract--------------------
         Attachment formAttach = new Attachment();
         formAttach.Name = 'TigerTuesday'+qt.Name+'.pdf';
         formAttach.body = b;
         formAttach.ContentType='application/pdf';
         formAttach.parentId =id;
         if (!Test.isRunningTest())
         {
          
           insert formAttach;
         }
        
            //send the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail } );
           
            return 'TigerTuesDay PDF  has been sent';
        }
        catch(exception ex)
        {
           
          string ex1=string.valueof(ex);
          return ex1;
            
        }

    }
    
}
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

var msg =sforce.apex.execute("SendTigerTuesday","Tuesday", {id:"{!TigerTuesday__c.Id}"}); 
window.alert(msg); 
window.location.href=location.href;


 
Hi All

How to overcome salesforce limitation System.LimitException: Too many SOQL queries: 101

 
List<MasterCopy__c> masterCopyList = new List<MasterCopy__c>([Select Name,DateUpdate__c, Opening_Balance__c, Closing_Balance__c, Master_Code__c, Master_Name__c from MasterCopy__c]);
    List<MasterCopy__c> upsertMasterList = new List<MasterCopy__c>();
    MasterCopy__c masterCopyInsert;
    List<MasterTest__c> masterTestList = new List<MasterTest__c>([Select Date__c, Opening_Balance__c, Master_Code__c, Name, Closing_Balance__c from MasterTest__c]);
    if(trigger.isBefore && trigger.isInsert  ){
        for(MasterTest__c masterTest : trigger.new){
            masterTest.EntryDate__c = masterTest.Date__c;
            masterTest.To_Date__c = masterTest.Date__c;
            masterTest.From_Date__c = masterTest.Date__c;
            
            
            masterTest.Closing_Balance__c = masterTest.Opening_Balance__c;
        }
    }

 
Hi Friends

I have created a custom button for sending mail.but i am facing error like this

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'soapenv:Server', faultstring:'java.lang.NullPointerException Error Id: 165621172-94001 (-590911820)',


 
if({!ISBLANK(Challan__c.Accounts_Email_Id__c)})
{
alert('Please Accounts email address');
}
else
{
{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")}
var msg =sforce.apex.execute("Send_Challn_To_Accounts","Send_Challn_To_Accounts",{id:"{!Challan__c.Id}"}); window.alert(msg);
}
global class Send_Challn_To_Accounts
{
public static blob b;

    WebService static string Send_Challn_To_Accounts(string id)
    {
     try
     {
              
          Challan__c qt=[Select id,Call_up_order_id__c,Freight_Charge_Applicable_Extra__c,Challan_id__c,Basic_Price_Each_item__c,Basic_Price_per_1000__c,Accounts_Email_Id__c,Sale_Confirmation_Order_ID__c,Account_Id__c,Account_Name__c,Company_Name__c,Account_Name__r.Name,Challan_Number__c,Sale_Confirmation_Order__r.name from Challan__c where id=:id];
        
        
            PageReference pdf =new PageReference('/apex/view_challan_form?scontrolCaching=1&id='+Id);
            
            pdf.setRedirect(true);
           
            if(Test.isRunningTest() == false){

       b = pdf.getContent();
}
        
        //--------create a mail object to send a single email.--------
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         
         string[] toaddress =String.valueOf(qt.Accounts_Email_Id__c).Split(',');

            mail.setToAddresses(toaddress);
          //  mail.setToAddresses(new string[] {qt.email__c}); // Internal_Email_User_Id__c text fied
          
            mail.setBccAddresses(new String[] {'test@globalnest.com'});
            mail.setBccSender(true);
          
        
            mail.setSenderDisplayName(qt.Account_Name__c);
            mail.setSubject('Challan For'+' '+qt.Company_Name__c+' : '+qt.Sale_Confirmation_Order__r.name);
            
        //------------- Create the email attachment-----------------
         Invoice_Dispatch_details__c invoice=new Invoice_Dispatch_details__c();
       //   invoice=[select id,Account_Lookup__c,Purchase_Order__c from Invoice_Dispatch_details__c where Challan__c=:id];
          
            
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('Challan.pdf');
            efa.setBody(b);
        //-----------------------------------------------------------
            mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
         
      mail.setPlainTextBody('Hi Accounts Team, Please find the Challan for '+qt.Company_Name__c +' '+'attached to this mail.'+'\n'+'\n'+'\n'+'\n'+'Freight Charge Applicable Extra:'+qt.Freight_Charge_Applicable_Extra__c+'\n'  +'Account Name:'+qt.Company_Name__c+'\n'+'SCO no:'+qt.Sale_Confirmation_Order__r.name+'\n'+'Challan No:'+qt.Challan_Number__c+'\n'+'Basic Price (Each item):'+qt.Basic_Price_Each_item__c+'\n'+'Basic Price (per 1000):'+qt.Basic_Price_per_1000__c+'\n'+'\n'+'Thanks & Regards'+'\n'+'Care Team');
        //------------------------Attach sales order to a contract--------------------
         Attachment formAttach = new Attachment();
         formAttach.Name = 'Challan'+qt.Account_Name__c+'.pdf';
         formAttach.body = b;
         formAttach.ContentType='application/pdf';
         formAttach.parentId =id;
         if (!Test.isRunningTest())
         {
          
           insert formAttach;
         }
        
            //send the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail } );
           
            return 'Challan has been sent';
        }
        catch(exception ex)
        {
           
          string ex1=string.valueof(ex);
          return ex1;
            
        }

    }
    
}


 
Hi All
I have created a page for entering multiple record at a time.if i am entering duplicate master code then its showing error message like this

User-added image
 
public class MasterTestEntryPage1
{
    public String message = System.CurrentPagereference().getParameters().get('msg');
    public List<AccountWrapper> wrappers {get; set;}
    public List<AccountWrapper> wrappers1 {get; set;}
    public List<MasterTest__c> master {get; set;}
    public List<BankBookTest__c> bankbook {get; set;}    
    public static Integer toDelIdent {get; set;}
    public static Integer addCount {get; set;}
    private Integer nextIdent=1;    
    
    public MasterTestEntryPage1(){
        wrappers=new List<AccountWrapper>();
        Wrappers1=new List<AccountWrapper>();
        for (Integer idx=0; idx<1; idx++){
            wrappers.add(new AccountWrapper(nextIdent++));
            wrappers1.add(new AccountWrapper(nextIdent++));
                    
        }
    }
 public void delWrapper(){
        Integer toDelPos=-1;
        for (Integer idx=0; idx<wrappers.size(); idx++){
           if (wrappers[idx].ident==toDelIdent){
                toDelPos=idx;
            }
        }        
        if (-1!=toDelPos){
            wrappers.remove(toDelPos);
            
        }
        }
 
 /* public void delWrapper()
{
    Integer toDelPos = -1;
    for( Integer idx = 0; idx < wrappers.size(); idx++ )
    {
        if( wrappers[idx].ident == toDelIdent )
        {
            toDelPos = idx;
        }
    }       

    if( toDelPos != -1 )
    {
        MasterTest__c bk = wrappers.get( toDelPos ).acc;
        wrappers.remove( toDelPos );
        
        delete bk;
    }
} */
    

    public void addRows(){
    
    List<MasterTest__c> accs=new List<MasterTest__c>();
        for (AccountWrapper wrap : wrappers){
            accs.add(wrap.acc);
        }        
        
    
        AccountWrapper objAccWrapper;
        for (Integer idx=0; idx<addCount; idx++){
            objAccWrapper = new AccountWrapper(nextIdent++);
            if(!wrappers.isEmpty()){
                objAccWrapper.acc.Date__c= wrappers[0].acc.Date__c;
                
                
            }
            wrappers.add(objAccWrapper);
        }
    }

 public PageReference save(){
  try{
  List<MasterTest__c> accs=new List<MasterTest__c>();
  for (AccountWrapper wrap : wrappers)
  {
  
   accs.add(wrap.acc);
   
  }
   insert accs;
  
  return new PageReference('/' + Schema.getGlobalDescribe().get('MasterTest__c').getDescribe().getKeyPrefix() + '/o');
  
  }
  
  catch(Exception e)
        {  
        //ApexPages.Message myMsg = new  ApexPages.Message(ApexPages.Severity.ERROR,'Sorry...... You have entered DUPLICATE MASTER CODE' );
           // ApexPages.addMessage(myMsg); 
         
           Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,' The code is duplicate or invalid. '));
       } 
 

        return null; 
  }
    public pageReference parentPage () {

          return new pageReference('/apex/MasterDetailsPage');
} 
    public class AccountWrapper{
        public MasterTest__c acc {get; private set;}
        public Integer ident {get; private set;}
        public AccountWrapper(Integer inIdent){
            ident=inIdent;
            acc=new MasterTest__c();
        }
    }
}
<apex:page controller="MasterTestEntryPage1" tabstyle="Account" showHeader="true" sidebar="false">

<apex:pageMessages id="showmsg" ></apex:pageMessages>
<apex:define name="body">


<script type="text/javascript">
function displaymessage()
{
alert("Remember to Delete blank row that you have made!");
}
</script>
            
            <div style="width:1000px;margin: 0px auto 10px auto;background-color:Gray;border: 1px solid black;">
             <apex:image id="theImage" value="{!$Resource.Emami}" width="100" height="100"/>
             <apex:outputLink style="font-weight: bold;float:right;" value="{!URLFOR($Page.LoginPage)}"><b>Back To Home</b></apex:outputLink>
 <apex:form >
   <apex:pageBlock title="Master Entry:">
   <apex:pageBlockSection columns="1"  ><h1><marquee>PLEASE ENTER DATE BEFORE CREATING MASTERS !!</marquee></h1>
       <apex:pageBlockTable value="{!wrappers}" var="wrapper"  style="width:70px;" >
                    <apex:column headerValue="Opening Balances as on"   >
                            <apex:inputField value="{!wrapper.acc.Date__c}"  required="true" />
                      </apex:column>
     </apex:pageBlockTable>
    
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable" >
      
      <apex:column headerValue="">
            <apex:commandButton value="X" action="{!delWrapper}" rerender="wtable" style="background:red">
               <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> 
            </apex:commandButton>
         </apex:column>
        <!--  <apex:column headerValue="Sl.No" style="background:pink;">
            <apex:outputText value="{!wrapper.ident}"/>
         </apex:column> -->
         <apex:column headerValue="Select Account" style="background:pink;">
            <!-- <apex:inputField value="{!wrapper.acc.Type__c}" /> -->
            <apex:selectList multiselect="false" size="1" value="{!wrapper.acc.Type__c}" onchange="showButton()">             
                <apex:selectOption itemvalue="Party Account" itemLabel="Party Account"/>
                <apex:selectOption itemvalue="Bank Account" itemLabel="Bank Account"/>                                
            </apex:selectList>
         </apex:column>
        

         <apex:column headerValue="Master Code" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Name}" />
         </apex:column>
          <apex:column headerValue="Master Name" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Master_Code__c}"  />
         </apex:column>
                  <apex:column headerValue="Opening Balance" style="background:pink;">
         
                        <apex:inputField value="{!wrapper.acc.Opening_Balance__c}"/>
                   
            
         </apex:column>
         
         <apex:column headerValue="Remarks" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Remarks__c}"/>
         </apex:column>
       
        
       
       <apex:column headerValue="">
            <apex:commandButton value="Enter" action="{!addRows}" rerender="wtable" style="background:pink" >
         <apex:param name="addCount" value="1" assignTo="{!addCount}"/> 
      </apex:commandButton>
         </apex:column>
       
        
      </apex:pageBlockTable>
      </apex:pageBlockSection>
      <apex:commandButton value="Add 5 Rows" action="{!addRows}" rerender="wtable">
         <apex:param name="addCount" value="5" assignTo="{!addCount}"/> 
      </apex:commandButton>
       <apex:commandButton value="View Master List" action="{!parentPage }" rerender="wtable">
          
      </apex:commandButton>
      <apex:commandButton value="Save Master" action="{!save}"  />
   </apex:pageBlock>
 </apex:form>
  </div>
        </apex:define>
        
        <center><br/>
        <b><i style="font-size:10px;color:red;">Developed By GlobalNest IT Solution Pvt.Ltd. <a href="http://www.globalnest.com" target="_blank">[http://www.Globalnest.com]</a> </i></b>
    </center><br/>
</apex:page>
User-added image

 
Hi Guys
I have created a class for searching record .after searching record i need to export that record in excel format.i mean i need one export button ,on click of that button its automatically download that record in excel format
<apex:page docType="html-5.0" standardController="MasterCopy__c"  extensions="dateInPBTbaleControllernewOk"  showHeader="false" sidebar="false">

<apex:pageMessages ></apex:pageMessages>
<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>


        <apex:define name="body">
            
            <div style="width:1000px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form id="tableId">
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.DateUpdate__c}" style="font-weight: bold;color:red;" required="false"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                
                 
                 <apex:outputPanel rendered="{!If(totalRevenue != totalRevenue1,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:red;font-size:15px;padding-left:49%"> Debit and Credit Balances do not match. </apex:outputLabel>
                 </apex:outputPanel>
                 
                 <apex:outputPanel rendered="{!If(account.DateUpdate__c== null,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:blue;font-size:15px;padding-left:1%" > Please enter date to fetch accurate results. </apex:outputLabel>
                 </apex:outputPanel>
                 
                 
                 
                 <apex:pageblockTable value="{!listAccount }" var="record">
               
                  <apex:column headerValue="Master Code" Value="{!record.Master_Name__c}" headerClass="colHeadr" style="font-weight: bold;font-size:12px;height=18px;text-align:center;">
                     <!----  <apex:column headerValue="Master Code">
                       <apex:outputPanel >
                            <apex:commandLink action="{!Go}">
                               {!record.Master_Name__c}<apex:param name="Id" value="{!record.id}"/>
                            </apex:commandLink>
                       </apex:outputPanel>
                    </apex:column>--->
                   
                   </apex:column>
                    <apex:column value="{!record.Master_Code__c}" headerValue="Master Name" headerClass="colHeadr" style="text-align:center;"/>
                    
                    
                    <apex:column value="{!record.Debit_Balance__c}" headerValue="Debit(+)" style="color:black;" headerClass="colHeadrRight" dir="RTL">
                     <apex:facet name="footer" >
        
                   <!---- <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false">
                      
                       
                    </apex:outputText>-->
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:black;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue}"  />
                    </apex:outputText> 
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.Credit_Balance__c}" headerValue="Credit(-)" style="color:black;"  headerClass="colHeadrRight" dir="RTL">
                    <apex:facet name="footer" >
                   
                        
                   <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:black;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText> 
                </apex:facet>
                 
            </apex:column>
            
           
          
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
    
      
      </div>
        </apex:define>
</apex:page>
public with sharing class dateInPBTbaleControllernewOk {
    public MasterCopy__c account{get;set;}
    public List<MasterCopy__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterCopy__c>> mapOfDateWithEntry;

    public dateInPBTbaleControllernewOk(ApexPages.StandardController controller){
    
        account = new MasterCopy__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
    }
     
   public void setValues(){
        listAccount  = new List<MasterCopy__c>([SELECT id,Name,  Closing_Balance__c,Credit__c,Date__c,DateUpdate__c,Debit__c,Debit_Balance__c,Credit_Balance__c,
        Group__c,Master_Code__c,Master_Name__c,New_Debit__c,New_Credit__c
                        FROM MasterCopy__c
                        order by Master_Name__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterCopy__c>>();
        List<MasterCopy__c> listOfEntryData;
        for(MasterCopy__c entry : listAccount){
            if(entry.DateUpdate__c != null){
                if(mapOfDateWithEntry.containsKey(entry.DateUpdate__c)){
                    mapOfDateWithEntry.get(entry.DateUpdate__c).add(entry);
                }
                else{
                    listOfEntryData = new List<MasterCopy__c>();
                    listOfEntryData.add(entry);
                    mapOfDateWithEntry.put(entry.DateUpdate__c,listOfEntryData);
                }
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
   }
   public void displaingTable(){
   
   
   try{
   
        setValues();
        
        
        
 
        if(account.DateUpdate__c!= null){
            totalRevenue = 0;
            totalRevenue1 = 0;
            totalRevenuee = 0;
            totalRevenuee1 = 0;
            system.debug('Map '+mapOfDateWithEntry);
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.DateUpdate__c)){
                listAccount = mapOfDateWithEntry.get(account.DateUpdate__c);
            }
            else {
                List<Date> sortedDateList = new List<Date>();
                sortedDateList.addAll(allDateSet);
                sortedDateList.sort();
                
                Boolean isAnyPastDate = false;
                Date requiredDate;
                for(Date recordDate : sortedDateList){
                    if(account.DateUpdate__c > recordDate){
                        requiredDate = recordDate;
                        isAnyPastDate = true;
                    }
                    else{
                        break;
                    }
                }
                if(isAnyPastDate){
                    listAccount = mapOfDateWithEntry.get(requiredDate);
                }
                else{
                    listAccount = new List<MasterCopy__c>();
                }
                /*Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                system.debug('Before Compare Date'+compareDate);
                for(Date keyDate : allDateSet){
                    if(keydate < account.DateUpdate__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.DateUpdate__c < keyDate){
                        count ++ ;
                    }
                }
                system.debug('After Compare Date'+compareDate);
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select DateUpdate__c from MasterCopy__c Order by DateUpdate__c Desc LIMIT 1][0].DateUpdate__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);*/
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
    
    }
    
    catch(Exception e)
        {  
        //ApexPages.Message myMsg = new  ApexPages.Message(ApexPages.Severity.ERROR,'Sorry...... You have entered DUPLICATE MASTER CODE' );
           // ApexPages.addMessage(myMsg); 
         
           Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,' NO RECORD FOUND'));
       }
       } 
     public void calculateTotalRevenue() {
     //for(MasterCopy__c acct2 : listAccount) {
           // if(acct2.Closing_Balance__c!= null)
               // totalRevenuee= acct2.Closing_Balance__c;
                //}
        for(MasterCopy__c acct : listAccount) {
            if(acct.Debit_Balance__c!= null)
                totalRevenue+= acct.Debit_Balance__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
             
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(MasterCopy__c acct1 : listAccount) {
            if(acct1.Credit_Balance__c!= null)
                totalRevenue1+= acct1.Credit_Balance__c;
                 
               
        }
        
    }
    
    
}


 
Hi Guys
I am looking for customizing my standard home page layout.can any body have sample code please share....

User-added image
Hi Friends
i have two fields one is text field (field__c) another is formula field (formula__c).if formula field value is "c2" and text field value is blank its showing error message .i have tried this but ist not working
 
if( curriculum .Product_Code__c =='C2' && curriculum .No_of_ups__c==null  )
        {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please fill the field value !!!...........'));
   return null;
        }

 
Hi Guys

I have created a validation rule like if one field blank then record would not be saved.its working but error message showing like this

Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please fill the Value: [].

why this error message coming.i need the only error message Please fill the value.

AND(
       Product_Code__c = "C2",  
   ISBLANK(No_of_ups__c)
)


How it is possible.
Hi Guys
I am facing one challenge for long time .I have two object Account and Discount__c with lookup relationship ,Account object have a picklist filed with value LEAD and CUSTOMER.

Now i have created a account record with picklist value LEAD. my requirment is when i am going to create a record on discount__c object the picklist value which was LEAD is converted to CUSTOMER autometically.that mean the parent object which have have child record then it will happens.how to achieve this solution ?
 
Hi All,

I have a trigger which updates attachment id into a custom field of object X__c. I have creatted a formula field with below formula to display the attached pic 

IMAGE('/servlet/servlet.FileDownload?file=customfield__c', customfield__c ,20,20).

But the image is not getting displayed.But if i replace the customfield__c with recordid like below , the image is getting displayed. Please help where i am going wrong.

IMAGE('/servlet/servlet.FileDownload?file=00P28000000Ezg4', customfield__c ,20,20).

Regards