• sales@myvarma
  • NEWBIE
  • 50 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 26
    Replies
after creation of reg card  24 hours later only agent fields must editable to few profiles like asm admin
or stage= Prospect

There is/should be a 24 Hour rule that will only allow ASM, Corporate, or System Admin users to adjust agent field after 24 hours has passed. Can we only apply this 24 hour rule once the Reg Card has been created or
the Connection stage is set to Prospect.


want validation rules
  EmailTemplate et=[Select id from EmailTemplate where name=:'Sales: New Customer Email'];


with out calling like this how to  give standar template to present mail update progrm


help me in this prgrm

 
trigger SendEmailToAccount on Contact (after insert,after update) 
{
    if(Trigger.isAfter)
    {
        if(Trigger.isInsert )
        { 
           
            HelperContactTrigger.sendEmail(trigger.new);
        }
    }
        if(trigger.isAfter && trigger.isUpdate )
        {           
         HelperContactTrigger.sendEmailafter(trigger.new);
        }
}
 
public with sharing class HelperContactTrigger {
    public static List<Contact> sendEmail(List<Contact>Contacts)
    {
     
        
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();   
        
        for(Contact con : Contacts)
        {
         
            if(con.AccountId != null && con.Email != null){

                                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

              
                singleMail.setTargetObjectId(con.Id);
                singleMail.setSaveAsActivity(false);
     

singleMail.setHtmlBody('Your record:<b> ' + case.Id +' </b>has been created.<p>');
            
                emails.add(singleMail);
            }
        }
           
        Messaging.sendEmail(emails);

        return Contacts;          
        
    }

    public static List<Contact> sendEmailafter(List<Contact>Contacts)
    {
        
               List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();   
        
        for(Contact con : Contacts)
        { 
         
            if(con.AccountId != null && con.Email != null){

               
                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

               
                singleMail.setTargetObjectId(con.Id);

                singleMail.setSaveAsActivity(false);

 singleMail.setHtmlBody('Your record:<b> ' + case.Id +' </b>has been updated.<p>');
              
               

                emails.add(singleMail);
            }
         }
           
        Messaging.sendEmail(emails);

        return Contacts;          
        }
    }

 
i m trying to send mail to using apex and vf page
help me


public class emailin_class
{
 public string subject_c{get; set;}
    public string email_body_c{get; set;}
    public string toAddresses{get; set;}  
list<string> emails = new list<string>();
 
 
 public PageReference send()
 {
      
 messaging.singleEmailmessage email=new messaging.singleEmailmessage();
 
 email.setSubject(subject_c);
 email.setPlainTextBody(email_body_c);

     email.setToAddresses(toAddresses);
   
 messaging.sendEmailResult[] r=messaging.sendEmail(new messaging.singleEmailmessage[] {email});
 
 
  return null;
 }

 }
 
<apex:page controller="emailin_class">
<apex:form >
    <apex:pageblock title="Email Messaging">
        <apex:pageblocksection columns="1">
    <b> Enter Email Subject:   </b>  
        <apex:inputtext value="{!subject_c}" maxlength="100"/>
       
       <!--  <b> Enter email_body: </b>
        <apex:inputTextarea value="{!email_body_c}" rows="6" cols="50" id="email_body"/>
         -->
        <apex:outputLabel for="email_body_c" value="Enter Body Here"/>
        <apex:inputtextarea value="{!email_body_c}" rows="6" cols="50" id="email_body_c"/> 
        
        
        <b>Enter Email ToRecipients:   </b>  
        <apex:inputtext value="{!toAddresses_c}" maxlength="50"/>
            
        </apex:pageblocksection>
       <apex:pageBlockButtons location="top">
           <apex:commandbutton value="Send Emails Now" action="{!send}"/>   
        </apex:pageBlockButtons>
           
    </apex:pageblock>
    
    </apex:form>

</apex:page>

 
global class updatesaccount implements 
    Database.Batchable<sObject>, Database.Stateful
{
    global Integer recordsProcessed = 0;

   global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(
            'SELECT ID, Phone, ' +
            'Fax, (SELECT ID, Phone, ' +
            'Fax FROM Contacts) FROM Account ' + 
            'Where Industry = \'Construction\''
        );
    }

    global void execute(Database.BatchableContext bc, List<Account> scope ){
        
      List<Contact> contacts = new List<Contact>();
        for (Account account : scope) {
            for (Contact contact : account.contacts) {
                contact.Phone = account.Phone;
                contact.Fax = account.Fax;
             
               
                
                contacts.add(contact);
               
                recordsProcessed = recordsProcessed + 1;
            }
        }
        update contacts;
    }    

    global void finish(Database.BatchableContext bc){
        System.debug(recordsProcessed + ' records processed. pradeepvarma');
        AsyncApexJob job = [SELECT Id, Status, NumberOfErrors, 
            JobItemsProcessed,
            TotalJobItems, CreatedBy.Email
            FROM AsyncApexJob
            WHERE Id = :bc.getJobId()];
       
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          String[] toAddresses = new String[] {'pradeep.gunturi@gmail.com'};
               mail.setSubject('Match Merge Batch ');
            mail.setPlainTextBody('hi pradeep batchapex completed');
         mail.setToAddresses(toAddresses);
       List<Messaging.SendEmailResult> sendRes = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }, true);
        
       
    }    

}


i want copy phone and fax of account whos industry is construction

but when ever we create new contact its sshowing whats problem in prgrm
how to update every account with same website value
User-added image



 
trigger updateact on Account(before update) {
 List<ID> accs=new List<ID>();
    Map<Id,Account> oldMap=Trigger.oldMap;
    Map<Id,Account> newMap=Trigger.NewMap;
   for(Id aid:oldMap.keySet())
   {
        if(oldMap.get(aid).AccountNumber!=newMap.get(aid).AccountNumberr)
        {
     accs.AccountNumber.addError(' Please contact Master Data to make this change.');
       }
    }
 
}

 
trigger updateact on Account (before update) {
map<id,Account> oldmap=trigger.oldmap;
    
    for(account acc: trigger.new){
        if (acc.AccountNumber != oldmap.get(acc.id).AccountNumber)
        {
            acc.AccountNumber.addError(' Please contact Master Data to make this change.');
        }
    }
 
}




when i m trying to edit account number which is already created
it must through error
i m getting errors 
help me
<apex:page controller="OppNameSearchController" >
    <apex:form id="form">
        <apex:pageBlock>
         
              <apex:pageBlockSection title="Search Filter" >
                Opportunity Name: <apex:inputText value="{!Name}"/>
                <apex:commandButton value="Search" action="{!method}" />
            </apex:pageBlockSection>
            <apex:pageMessages ></apex:pageMessages>
            
        </apex:pageBlock>
        <apex:pageblock>
<apex:pageBlockTable value="{!Opp}" var="row" rendered="{!show}">
<apex:column >
<apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
</apex:column>

                                                                                                  
               
    <script type="text/javascript">
    function popupwindow()
    {
        var newwindow = window.open('/apex/OppNameSearchController','newwindow','height=400','width=1000','left=100','top=100'); 
       
    }
    </script>     
    <apex:commandButton action="{!edit}" value="edit" onclick="popupwindow()"/>   
            <apex:column value="{!row.Name}"/>
            <apex:column value="{!row.Amount}"/>
            </apex:pageBlockTable>
        </apex:pageblock>
           
</apex:form>
</apex:page>
 
public class OppNameSearchController {
    public list<Opportunity>Opp{set;get;}
    public string Name{set;get;}
    public Decimal amount{set;get;}
    
    public boolean show{set;get;}
    
    public OppNameSearchController()
    {
        Opp = new List<Opportunity>();
        Opp= [select id, Name, Amount from Opportunity];
    }
    public void method()
    {
      
        integer OppCount=[select count() from Opportunity where Name LIKE: Name+'%'];
        if(OppCount != 0)
        {
            Opp = [select  name, Amount from Opportunity where Name LIKE: Name+'%' ];
            show = true;
        }
        else
        {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'There are no Opportunities with the Name -'+Name);
            ApexPages.addMessage(myMsg);
            show = false;
        }
    }
    
    public void save()
    {
        
        update Opp;
     
    }
     public void edit()
 {
     String oppid= ApexPages.currentPage().getParameters().get('oppid'); 
 }
 
     public void clear(){  	
  
        Opp=NULL;
                  
   }  
}

 
i want to get results even if i give single letter in searchfield
help me in getting output i tried to manage but still errors 




public class OppNameSearchController {
    public string Name{set;get;}
    public Decimal amount{set;get;}
    public Opportunity Opp{set;get;}
    public string searchstring {get;set;} 
    public boolean show{set;get;}
    
    public void method()
    {
        
       if(searchstring != null && searchstring != '' ){  
    string searchquery='select Name, Amount from opportunity where Name like \'%'+searchstring+'%\'  Limit 10';  
    
     Opp = Database.query(searchstring); 
           show = true;

                   }
        else
        {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'There are no Opportunities with the Name -'  +searchstring);
            ApexPages.addMessage(myMsg);
            show = false;
        }
    }
    
    public void save()
    {
        Opportunity op = Opp;
        update op;
      }
     public void clear(){  
   opp.clear();  
   }  
}







<apex:page controller="OppNameSearchController" >
    <apex:form>
        <apex:pageBlock >
            <apex:pageBlockSection title="Search Filter" >
                Opportunity Name: <apex:inputText value="{!searchstring}"/>
                <apex:commandButton value="Search" action="{!method}" />
            </apex:pageBlockSection>
            <apex:pageMessages ></apex:pageMessages>
            
            
            <apex:pageBlockSection title="Searched Record" rendered="{!show}" >
                <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" 
                                        hideOnEdit="editButton" event="ondblclick" 
                                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit">
                    <apex:outputField value="{!Opp.Name}"></apex:outputField>
                    <apex:outputField value="{!Opp.Amount}"/>
                </apex:inlineEditSupport>
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!clear}" value="reset"/>
            </apex:pageBlockSection>
        </apex:pageBlock>        
           
        
    </apex:form>
</apex:page>



 
i mm trying to create vf page search field 
when i search with name should get opportunities with that name 
and we should get option to edit their it self
only aggregate expressions use field aliasing
Unknown property 'oppsearch.searchText'



i got two errors in program
public class oppsearch 
{

   String searchText;
   List<opportunity> results;

   public String getSearchText()
   {
      return searchText;
   }

   public void setSearchText(String s) 
   {
      searchText = s;
   }

   public List<opportunity> getResults()
   {
      return results;
   }

   public PageReference doSearch() {
      results = (List<opportunity>)[FIND :searchText RETURNING opportunity(Account name, amount, Phone)][0];
      return null;
   }

}



<apex:page controller="oppsearch ">
   <apex:form >
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Go!" action="{!doSearch}" 
                                      rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l" 
                               rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.account name}"/>
              <apex:column value="{!l.phone}"/>
               <apex:column value="{!l.amount}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>
                    


 
after searching if we get re ords with that name it should have options beside to every record to edit or delete the record
when we search with a name it should result opportunity with that name and we should get option to edit or delete in same page
i tried some thing
help me yar

class:

public class oppsearch {
    public List<opportunity> emps{set;get;}
    public string Account name{get;set;}
    public decimal Amount{get;set;}
    public string lead source{get;set;}
    public integer phone{get;set;}
    public string type{get;set;}
    public string opportunity owner{get;set;}
           public String searchData{set;get;}
       
    
    public oppsearch ()
         {
             emps = new List<opportunity>();
          }
          
    public void search()
             {
              opps = [select id, Account name, Amount, lead source, phone, opportunity owner, type from opportunity  where Account name=:searchData];
            }
    
    public void editopps()
             {
             String oppsid= ApexPages.currentPage().getParameters().get('oppsid'); 
 
                 }

    public void Deleteopps()
               {
            String oppsid= ApexPages.currentPage().getParameters().get('oppsid'); 
     
               opportunity opps = [Select id from opportunity where id =:oppsid limit 1];
             if(opps !=null && opps.id !=null)
            {
              delete opps;
             }
             

}
}



vf page::


<apex:page controller="oppsearch" showHeader="false" sidebar="false">
    
    <apex:form id="form">
        <apex:pageBlock mode="inlineEdit">
            <apex:pageBlockButtons location="top">
                
               Enter opportunity name:-<apex:inputText value="{!searchData}" />
            <apex:commandButton value="Searchdata" action="{!search}"/> <br/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        <apex:pageBlock >
        <apex:pageBlockTable value="{!opps}" var="row">
<apex:column >
<apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
<a href="javascript&colon;if (window.confirm('Are you sure?')) Deleteopportunity('{!row.Id}');" style="font-weight:bold">Del</a>
</apex:column>
               
         
            <apex:column value="{!row.Account Name}"/>
            <apex:column value="{!row.Amount}"/>
            <apex:column value="{!row.Lead Source}"/>
            <apex:column value="{!row.phone}"/>
            <apex:column value="{!row.Type}"/> +
              <apex:column value="{!row.Opportunity Owner}"/>
                   
            </apex:pageBlockTable>
        </apex:pageBlock>
            
            <apex:actionFunction action="{!Deleteopps}" name="Deleteopps" reRender="form" >
<apex:param name="opportunityid" value="" assignTo="{!SelectedopportunityId}"/>
</apex:actionFunction>
        
     </apex:form>
</apex:page>
 
i want to add annual revenue amount in the  account object to opportunities equally  in that account 
help me with program
urgent now
how to get annual revenue in account  and split to opportunities under that account 
using trigger plzzzzzzzzz help me
hey i want to create account records when every lead converted but should automatically check for duplicates if it was duplicate account with "name" should  update all  the data in to old account record only, instead of creating new account record.
 
i tried my best  but not working 
instead error 
i must update the new values to old record with same name help me



trigger accounttrigger on Account (before insert, before update) {

     Map<String, Id> mapAccount = new Map<String, Id>();
    
    Set<String> setAccName = new Set<String>();
    for(Account acc : trigger.new)
        setAccName.add(acc.Name);
        
    for(Account acc : [ SELECT Id, Name FROM   Account WHERE  Name IN :setAccName ] )
        mapAccount.put(acc.Name, acc.Id);
    
    for(Account acc : trigger.new)
        if(mapAccount.containsKey(acc.Name) && mapAccount.get(acc.Name) != acc.Id)
            acc.addError( 'There is already another Account with the same Name. '  +  
                mapAccount.get(acc.Name) + '\'>' + acc.Name + '</a>', FALSE );
}
when account creating it should check for duplicate
if same name must update new values in old record 


help bros
  EmailTemplate et=[Select id from EmailTemplate where name=:'Sales: New Customer Email'];


with out calling like this how to  give standar template to present mail update progrm


help me in this prgrm

 
trigger SendEmailToAccount on Contact (after insert,after update) 
{
    if(Trigger.isAfter)
    {
        if(Trigger.isInsert )
        { 
           
            HelperContactTrigger.sendEmail(trigger.new);
        }
    }
        if(trigger.isAfter && trigger.isUpdate )
        {           
         HelperContactTrigger.sendEmailafter(trigger.new);
        }
}
 
public with sharing class HelperContactTrigger {
    public static List<Contact> sendEmail(List<Contact>Contacts)
    {
     
        
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();   
        
        for(Contact con : Contacts)
        {
         
            if(con.AccountId != null && con.Email != null){

                                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

              
                singleMail.setTargetObjectId(con.Id);
                singleMail.setSaveAsActivity(false);
     

singleMail.setHtmlBody('Your record:<b> ' + case.Id +' </b>has been created.<p>');
            
                emails.add(singleMail);
            }
        }
           
        Messaging.sendEmail(emails);

        return Contacts;          
        
    }

    public static List<Contact> sendEmailafter(List<Contact>Contacts)
    {
        
               List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();   
        
        for(Contact con : Contacts)
        { 
         
            if(con.AccountId != null && con.Email != null){

               
                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

               
                singleMail.setTargetObjectId(con.Id);

                singleMail.setSaveAsActivity(false);

 singleMail.setHtmlBody('Your record:<b> ' + case.Id +' </b>has been updated.<p>');
              
               

                emails.add(singleMail);
            }
         }
           
        Messaging.sendEmail(emails);

        return Contacts;          
        }
    }

 
i m trying to send mail to using apex and vf page
help me


public class emailin_class
{
 public string subject_c{get; set;}
    public string email_body_c{get; set;}
    public string toAddresses{get; set;}  
list<string> emails = new list<string>();
 
 
 public PageReference send()
 {
      
 messaging.singleEmailmessage email=new messaging.singleEmailmessage();
 
 email.setSubject(subject_c);
 email.setPlainTextBody(email_body_c);

     email.setToAddresses(toAddresses);
   
 messaging.sendEmailResult[] r=messaging.sendEmail(new messaging.singleEmailmessage[] {email});
 
 
  return null;
 }

 }
 
<apex:page controller="emailin_class">
<apex:form >
    <apex:pageblock title="Email Messaging">
        <apex:pageblocksection columns="1">
    <b> Enter Email Subject:   </b>  
        <apex:inputtext value="{!subject_c}" maxlength="100"/>
       
       <!--  <b> Enter email_body: </b>
        <apex:inputTextarea value="{!email_body_c}" rows="6" cols="50" id="email_body"/>
         -->
        <apex:outputLabel for="email_body_c" value="Enter Body Here"/>
        <apex:inputtextarea value="{!email_body_c}" rows="6" cols="50" id="email_body_c"/> 
        
        
        <b>Enter Email ToRecipients:   </b>  
        <apex:inputtext value="{!toAddresses_c}" maxlength="50"/>
            
        </apex:pageblocksection>
       <apex:pageBlockButtons location="top">
           <apex:commandbutton value="Send Emails Now" action="{!send}"/>   
        </apex:pageBlockButtons>
           
    </apex:pageblock>
    
    </apex:form>

</apex:page>

 
global class updatesaccount implements 
    Database.Batchable<sObject>, Database.Stateful
{
    global Integer recordsProcessed = 0;

   global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(
            'SELECT ID, Phone, ' +
            'Fax, (SELECT ID, Phone, ' +
            'Fax FROM Contacts) FROM Account ' + 
            'Where Industry = \'Construction\''
        );
    }

    global void execute(Database.BatchableContext bc, List<Account> scope ){
        
      List<Contact> contacts = new List<Contact>();
        for (Account account : scope) {
            for (Contact contact : account.contacts) {
                contact.Phone = account.Phone;
                contact.Fax = account.Fax;
             
               
                
                contacts.add(contact);
               
                recordsProcessed = recordsProcessed + 1;
            }
        }
        update contacts;
    }    

    global void finish(Database.BatchableContext bc){
        System.debug(recordsProcessed + ' records processed. pradeepvarma');
        AsyncApexJob job = [SELECT Id, Status, NumberOfErrors, 
            JobItemsProcessed,
            TotalJobItems, CreatedBy.Email
            FROM AsyncApexJob
            WHERE Id = :bc.getJobId()];
       
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          String[] toAddresses = new String[] {'pradeep.gunturi@gmail.com'};
               mail.setSubject('Match Merge Batch ');
            mail.setPlainTextBody('hi pradeep batchapex completed');
         mail.setToAddresses(toAddresses);
       List<Messaging.SendEmailResult> sendRes = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }, true);
        
       
    }    

}


i want copy phone and fax of account whos industry is construction

but when ever we create new contact its sshowing whats problem in prgrm
how to update every account with same website value
User-added image



 
trigger updateact on Account(before update) {
 List<ID> accs=new List<ID>();
    Map<Id,Account> oldMap=Trigger.oldMap;
    Map<Id,Account> newMap=Trigger.NewMap;
   for(Id aid:oldMap.keySet())
   {
        if(oldMap.get(aid).AccountNumber!=newMap.get(aid).AccountNumberr)
        {
     accs.AccountNumber.addError(' Please contact Master Data to make this change.');
       }
    }
 
}

 
i mm trying to create vf page search field 
when i search with name should get opportunities with that name 
and we should get option to edit their it self
when we search with a name it should result opportunity with that name and we should get option to edit or delete in same page
i tried some thing
help me yar

class:

public class oppsearch {
    public List<opportunity> emps{set;get;}
    public string Account name{get;set;}
    public decimal Amount{get;set;}
    public string lead source{get;set;}
    public integer phone{get;set;}
    public string type{get;set;}
    public string opportunity owner{get;set;}
           public String searchData{set;get;}
       
    
    public oppsearch ()
         {
             emps = new List<opportunity>();
          }
          
    public void search()
             {
              opps = [select id, Account name, Amount, lead source, phone, opportunity owner, type from opportunity  where Account name=:searchData];
            }
    
    public void editopps()
             {
             String oppsid= ApexPages.currentPage().getParameters().get('oppsid'); 
 
                 }

    public void Deleteopps()
               {
            String oppsid= ApexPages.currentPage().getParameters().get('oppsid'); 
     
               opportunity opps = [Select id from opportunity where id =:oppsid limit 1];
             if(opps !=null && opps.id !=null)
            {
              delete opps;
             }
             

}
}



vf page::


<apex:page controller="oppsearch" showHeader="false" sidebar="false">
    
    <apex:form id="form">
        <apex:pageBlock mode="inlineEdit">
            <apex:pageBlockButtons location="top">
                
               Enter opportunity name:-<apex:inputText value="{!searchData}" />
            <apex:commandButton value="Searchdata" action="{!search}"/> <br/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        <apex:pageBlock >
        <apex:pageBlockTable value="{!opps}" var="row">
<apex:column >
<apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
<a href="javascript&colon;if (window.confirm('Are you sure?')) Deleteopportunity('{!row.Id}');" style="font-weight:bold">Del</a>
</apex:column>
               
         
            <apex:column value="{!row.Account Name}"/>
            <apex:column value="{!row.Amount}"/>
            <apex:column value="{!row.Lead Source}"/>
            <apex:column value="{!row.phone}"/>
            <apex:column value="{!row.Type}"/> +
              <apex:column value="{!row.Opportunity Owner}"/>
                   
            </apex:pageBlockTable>
        </apex:pageBlock>
            
            <apex:actionFunction action="{!Deleteopps}" name="Deleteopps" reRender="form" >
<apex:param name="opportunityid" value="" assignTo="{!SelectedopportunityId}"/>
</apex:actionFunction>
        
     </apex:form>
</apex:page>
 
how to get annual revenue in account  and split to opportunities under that account 
using trigger plzzzzzzzzz help me
instead error 
i must update the new values to old record with same name help me



trigger accounttrigger on Account (before insert, before update) {

     Map<String, Id> mapAccount = new Map<String, Id>();
    
    Set<String> setAccName = new Set<String>();
    for(Account acc : trigger.new)
        setAccName.add(acc.Name);
        
    for(Account acc : [ SELECT Id, Name FROM   Account WHERE  Name IN :setAccName ] )
        mapAccount.put(acc.Name, acc.Id);
    
    for(Account acc : trigger.new)
        if(mapAccount.containsKey(acc.Name) && mapAccount.get(acc.Name) != acc.Id)
            acc.addError( 'There is already another Account with the same Name. '  +  
                mapAccount.get(acc.Name) + '\'>' + acc.Name + '</a>', FALSE );
}

I have a Vf page which display account object records. In this vf page each and every record have a button called Edit. If we click on Edit button it should be take us to detailed edit page respected record. For more clearance see my pictures which i uploded. 
User-added image
User-added image

To achive this process, I have developed following VF page.

<apex:page Controller="Redirect_Main2" action="{!Redirect_Main}">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a" >
                <apex:column value="{!a.Id}"/>
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Industry}"/>
                <apex:column id="two">
                    <apex:commandButton value=" Edit " onclick="window.open('/{!a.id}')" reRender="two"/>
<!--/e?retURL=%2F{!a.id}&_CONFIRMATIONTOKEN=VmpFPSxNakF4Tmkwd055MHlPVlF3T1Rvek5qb3dPQzQ0TnpaYSxvTFl3eklmdmNBcjl6RlVDeDRWUnBtLE9XWTJNbU01&common.udd.actions.ActionsUtilORIG_URI=%2F{!a.id}%2Fe')" reRender="two"/>
   -->             </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller:
public class Redirect_Main2 {

   public List<Account> accs { get; set; }
    public PageReference Redirect_Main(){
        accs = [select id,name,phone,Industry from account];       
        return null;
     }
}
 


But this is taking me to detailed page of the record but not edit page. Please tell me neccessary actions which i need to take.

Thanking you
KS Kumaar

hi gyus... This code is working fine..when ever I insert or update record it sends email.. but I am quite confused  so plz explain me the use of line 16,line 19,line 25 & what is the use of flag... and tell me that is messaging.singleEmailMessage is defined keyword...??
Last but not the least I want to edit the code in such a way that if i insert the data with dataloader where there is more than one contact then send email to more than one contact is inserted at a time....

************apex class**********
public with sharing class HelperContactTrigger {
    public static List<Contact> sendEmail(List<Contact>Contacts)
    {
     //query on template object
        EmailTemplate et=[Select id from EmailTemplate where name=:'Sales: New Customer Email'];

        //list of emails
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();   
        
        for(Contact con : Contacts)
        {
          //check for Account
            if(con.AccountId != null && con.Email != null){

                //initiallize messaging method
                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

                //set object Id
                singleMail.setTargetObjectId(con.Id);

                //set template Id
                singleMail.setTemplateId(et.Id);

                //flag to false to stop inserting activity history
                singleMail.setSaveAsActivity(false);

                //add mail
                emails.add(singleMail);
            }
        }
            //send mail
        Messaging.sendEmail(emails);

        return Contacts;          
        
    }

    public static List<Contact> sendEmailafter(List<Contact>Contacts)
    {
    //query on template object
        EmailTemplate et=[Select id from EmailTemplate where name=:'Sales: New Customer Email'];

        //list of emails
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();   
        
        for(Contact con : Contacts)
        {
          //check for Account
            if(con.AccountId != null && con.Email != null){

                //initiallize messaging method
                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

                //set object Id
                singleMail.setTargetObjectId(con.Id);

                //set template Id
                singleMail.setTemplateId(et.Id);

                //flag to false to stop inserting activity history
                singleMail.setSaveAsActivity(false);

                //add mail
                emails.add(singleMail);
            }
         }
            //send mail
        Messaging.sendEmail(emails);

        return Contacts;          
        }
    }

*********Apex trigger********
trigger SendEmailToAccount on Contact (after insert,after update) 
{
    if(Trigger.isAfter)
    {
        if(Trigger.isInsert )
        { 
            //helper class for single email but bulk messages
            HelperContactTrigger.sendEmail(trigger.new);
        }
    }
        if(trigger.isAfter && trigger.isUpdate )
        {           
         HelperContactTrigger.sendEmailafter(trigger.new);
        }
}