• 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 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