• Soundar
  • NEWBIE
  • 205 Points
  • Member since 2016

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 33
    Questions
  • 61
    Replies
Hi Guys,

I need to send Email alert for today created contacts list . 
Contact records are inserted through automation. Manager expecting in single mail to fetch list of contact records creted by today .
Can you please guide me , how to i achive this ? 


Ex:Email template 

HI Manger,
Today Contact records listed below .

ID   name         mail                        phone    createddate
001  sasi         sasi@gmail.com       123         today
002   sachin     sacina@gmai.com    234         today
003  sehwag     sehwag@gmail.com  345        today

Thanks& Regards,
Sasidhar



















  
 
How to add inline edit to VF page and pagination function? (for Title,Email and Birthdate)

Thanks!
 
<apex:page Controller="AccContact">
  <apex:form >
      
      <apex:pageBlock >
  <apex:pageBlockTable value="{!acclst}" var="a">
      
   
 <apex:column headerValue="Name">
  <apex:commandLink action="{!selacc}">
  <apex:param name="conlst" value="{!a.id}"/>
  <apex:outputText value="{!a.name}"/>
  </apex:commandlink>
  </apex:column>
  <!--accounts-->
   </apex:pageBlockTable>
    <apex:pageBlockTable value="{!accconts1}" var="a">
    <apex:column headerValue="Account Name" value="{!a.Name}"/>
    <!--contacts-->
    <apex:column headerValue="List contacts">
   <apex:pageBlockTable value="{!a.contacts}" var="c">
       
          <apex:column headerValue="Title">
  <apex:outputText value="{!c.title}"></apex:outputText>
  </apex:column>
  
       
    <apex:column headerValue="First Name">
  <apex:outputText value="{!c.firstname}"></apex:outputText>
  </apex:column>
       
  <apex:column headerValue="Last Name">
  <apex:outputText value="{!c.lastname}"></apex:outputText>
  </apex:column>
   
   <apex:column headerValue="Email">
  <apex:outputText value="{!c.email}"></apex:outputText>
  </apex:column>

     <apex:column headerValue="Birthdate">
  <apex:outputText value="{!c.birthdate}"></apex:outputText>
  </apex:column>
       
  
 </apex:pageBlockTable> <!-- End contact-->
 </apex:column>
 </apex:pageBlockTable><!--end account-->
  </apex:pageBlock>
         

  </apex:form>
</apex:page>
 
public with sharing class AccContact {

    public list<contact> conlst { get; set; }

   // public contact c { get; set; }
   /* public  void getSelacc() {
    }*/

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

    public PageReference selacc() {
    string getid=apexpages.currentpage().getparameters().get('conlst');
         accconts1=[select id,name,(select id,lastname,firstname,email,title,birthdate from contacts)  from account where id=:getid ];
            system.debug(accconts1);
      return null;
    }


    public List<Account> acclst { get; set; }
   public  AccContact (){
     acclst=[select id,name  from account ];
     system.debug(acclst);
   
   }

}


       

 
Hi friends,

Is it possible to refresh a page from visualforce page witout calling an Apex Class. 

1. I saved one record from visualforce page, Now Record's are saved successfully. 
2. And still data's are enabled in relevant fields after records are saved.
3. Right Now i am using finally, it's Working wonderfully.
finally {
attachment = New Attachment();
}
4. And Now I want to refresh a page from visualforce Page itself without calling an apex Class / Controller.


********Sample Apex********
public with sharing class AttachmentUploadController {

    public AttachmentUploadController(){
      
    }
    
    Public Attachment attachment{
        
        get{
            if(attachment == Null){
                attachment = New Attachment();
            }
            return attachment;
        }
        set;
    } 
    
    Public Pagereference upload(){
        
        attachment.OwnerId = userInfo.getUserId();
        attachment.ParentId = ApexPages.currentPage().getParameters().get('Id');
        attachment.IsPrivate = False;
        try{
        Insert attachment;
            
        }Catch(DMLException e){
            ApexPages.addMessage(New ApexPages.message(ApexPages.Severity.ERROR,'Error uploading attachment'));
            return Null;   
            
        }
       finally{
            
            attachment = New Attachment();   // Solved By Using Finally ....
        }
        ApexPages.addMessage(New ApexPages.message(ApexPages.Severity.CONFIRM, 'Attachment uploaded successfully'));    
        //attachment = New Attachment();
        return Null;
        
    }
   

}

*********** Sample VF Page  *************

Thanks In Advance.


Regards,

Soundar
Hi Expect,

Could You Please advise me ! Why pagination is not working in wrapper class. I tried seperately (pagination & wrapper) as well, it's working in sepetaetly but not working when i include pagination with wrapper.

*********Apex Class ************
public class OpportunityListWithWrapperClass {
   
    //Variables for Wrapper
    public List<wrapperClass> wrapperList{get;set;}
    public boolean normalList{get;set;}
    public boolean selectedList{get;set;}
    Public List<WrapperClass> SelectedWrapperList{get;set;} 
    
    //Variable For Pagination
    public Integer size{get;set;}
    public Integer noOfRecords{get;set;}
    Public List<SelectOption> paginationSizeFixing{get;set;}
    
     //Constructor 
    public OpportunityListWithWrapperClass(){
        normalList = True;
        selectedList = False;
    	selectOpp(); 
        size=5;
        
        paginationSizeFixing = New List<selectOption>();
        paginationSizeFixing.add(New selectOption('5','5'));
        paginationSizeFixing.add(New selectOption('10', '10'));
        paginationSizeFixing.add(New selectOption('20', '20'));
        paginationSizeFixing.add(New selectOption('30', '30'));
    }
    
    
    //Method For Pagination for Wrapper
    Public Apexpages.StandardSetController setCon{
        
        get{if(setCon == Null){
            
            setCon = New ApexPages.StandardSetController(database.getQueryLocator([select Id,name,accountId,account.name,stageName,Amount,closeDate
                                                                               From Opportunity]));    
             setCon.setPageSize(Size);
       		 noOfrecords = setCon.getResultSize();            
            }
            return setCon;
        }
             
        set;
        
    }
    
    public PageReference refreshSize(){
        setCon.setPageSize(Size);
        return Null;
    }
    
    Public List<Opportunity> getOpportunities(){
        return (List<Opportunity>) setCon.getRecords();
    }
    
   
    
    public void selectOpp(){
        
        List<Opportunity> allOpp = [select Id,name,accountId,account.name,stageName,Amount,closeDate
                                                                               From Opportunity];
        
        set<Id> oppId = New Set<Id>();
        
        for(Opportunity opp : allOpp){
            
            oppId.add(opp.accountId);
        }
        
        List<Account> relatedAccount = [Select id,name from Account Where ID IN: oppId];
        
        wrapperList = new list<wrapperClass>();

        for(Opportunity childRec : allOpp ){
            
            for(Account parentRec : relatedAccount){
                
                if(parentRec.Id == childRec.AccountId){
                    wrapperClass wrap = New WrapperClass();
                    wrap.acc = parentRec;
                    wrap.opp = childRec;
                    wrapperList.add(wrap);
                }
                if(parentRec.Id == Null){
                    wrapperClass wrap = new WrapperClass();
                    wrap.opp = childRec;
                    wrapperList.add(wrap);
                }
            }
            
            
        }
        
    } 
    
    public void proceedWithSelected(){
        selectedWrapperlist = new List<wrapperClass>();
        normalList = false;
        selectedList = true;
        
        for(wrapperClass selectedWrapObj : wrapperList){
            if(selectedWrapObj.selected == True){
                selectedWrapperlist.add(selectedWrapObj);
                if(selectedWrapperlist != Null){
                apexPages.addMessage(New ApexPages.message(Apexpages.Severity.CONFIRM, 'Cheers !! Its Your Selected Opportunities' ));
                }
            }
        }
        
    }
    
    
    public Class wrapperClass{
        public Account acc{get;set;}
        public Opportunity opp{get;set;}
        public boolean selected{get;set;}
        public wrapperClass(){
            selected = false;
        }
    } 
}

****** Visualforce *********
 
<apex:page controller="OpportunityListWithWrapperClass" tabStyle="Opportunity">
    <apex:form >
        <apex:actionFunction name="refreshSizeOfPage" action="{!refreshSize}" reRender="pbId" status="fetchStatus" />
        <apex:sectionHeader title="Opportunity Details" subtitle="With Related Accounts"/>
        <apex:pageMessages />
        <apex:pageBlock id="pbId" title="Oportunity Details">
            <apex:commandButton value="Proceed With Selected" action="{!proceedWithSelected}"/>
            <apex:pageBlockSection columns="1">
                
                <apex:pageBlockTable value="{!wrapperList}" var="wrap" rendered="{!normalList}">
                    
                    <apex:column headerValue="Select">
                    	 <apex:inputCheckbox value="{!wrap.selected}"/>
                    </apex:column>
                    
                    <apex:column value="{!wrap.opp.name}"/>
                    
                    <apex:column value="{!wrap.acc.name}" />
                </apex:pageBlockTable>
                
                <apex:pageBlockTable value="{!selectedWrapperList}" var="wrap" rendered="{!selectedList}">
                    
                    <apex:column headerValue="Selected">
                        <apex:inputCheckbox value="{!wrap.selected}"/>
                    </apex:column> 
                    <apex:column value="{!wrap.opp.name}" />
                    <apex:column value="{!wrap.acc.name}" />
                    
                </apex:pageBlockTable>
                
                
             
            </apex:pageBlockSection>
            
            <apex:panelGrid columns="8">
                    <apex:selectList value="{!size}" multiselect="false" onchange="refreshSizeOfPage();" size="1">
                        <apex:selectOptions value="{!paginationSizeFixing}" />
                    </apex:selectList>
                   
                   <apex:commandButton status="fetchStatus" title="Previous Page" reRender="pbId" value="first"
                                       action="{!setCon.first}" disabled="{!!setCon.hasPrevious}"/>
					<apex:commandButton status="fetchStatus" title="Previous Page" value="Previous" reRender="pbId"
                                        action="{!setCon.Previous}" disabled="{!!setcon.hasPrevious}"/>
                    <apex:commandButton status="fetchStatus" title="Next Page" value="Next" reRender="pbId"
                                         action="{!setCon.Next}" disabled="{!!setCon.hasNext}"/>
                   <apex:commandButton status="fetchStatus" title="Last Page" value="Last" reRender="pbId"
                                       action="{!setCon.last}"  disabled="{!!setCon.hasNext}"/>
                   
                   <apex:outputLabel >
                   	{!(setCon.pageNumber * size)+1-size}-{!(setCon.pageNumber * Size)} of {!noOfRecords}
                   </apex:outputLabel>
                   
                   <apex:outputPanel >
                       <apex:actionStatus id="fetchStatus">
                           <apex:facet name="start">
                               <img src="https://media.giphy.com/media/l4eA8oZpx71oQ/giphy.gif" width="25" height="25"/>
                           </apex:facet>
                       </apex:actionStatus>
                   </apex:outputPanel>
                </apex:panelGrid>
            
            
        </apex:pageBlock>
    </apex:form>
</apex:page>


   <!--<apex:pageBlockTable value="{!wrapperList}" var="wrap" rendered="{!normalList}">
                    <apex:column headerValue="Select">
                    	 <apex:inputCheckbox value="{!wrap.selected}"/>
                    </apex:column>
                    <apex:column value="{!wrap.opp.name}" />      
                    <apex:column value="{!wrap.acc.name}" />
                </apex:pageBlockTable>
                </apex:pageBlockSection> 
            <apex:pageBlockSection columns="1"> 
                <apex:pageBlockTable value="{!selectedWrapperList}" var="wrap" rendered="{!selectedList}">
                    
                    <apex:column headerValue="Selected">
                        <apex:inputCheckbox value="{!wrap.selected}"/>
                    </apex:column> 
                    <apex:column value="{!wrap.opp.name}" />
                    <apex:column value="{!wrap.acc.name}" />
                    
                </apex:pageBlockTable> -->

**** Currently Showing Output****


User-added image



Thnaks in Advance!!

Regards,
Soundar 
Hi JavaScript & Jquery Expects,

I have one requirement i want tag option by using javascript or jquery ,  having one image with some fields (Attached in that image). When i click that place it's need to  show small message on top of the image. for ex: if I Click  ' 5 ' a message would be showing on top ('You Are tagging 5 From Image 1') .  Kindly Check the below Image for Your Information. Could You please show me some sample code.

I hope expert can do anything ...

User-added image

Thanks In Advance..

Regards,
Soundar
Dear Friends,

Could anyone give a Clear explaination the main difference between before insert & Update , after Insert & Update with good Example.

Regards,

Soundar.
Dear friends,

I like to reduce this Query size (four --> single ) . Kindly advise me once how it's possible by using Map
 
public class OppUsdUpdate {
    
    public static void usdUpdate(Id Opportunity, String str){
    
        List<Opportunity> oppList = New List<Opportunity>();
        
                          
        List<Opportunity> oppQry = [Select id, name, USD_Amount1__c,Amount, Currency__c from  Opportunity where Id =:Opportunity];
         
        CurrencyType__c cTypeInr  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where 
                                    ISO_Code__c = 'INR'  Limit 1];
          
        CurrencyType__c cTypeUsd  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where ISO_Code__c = 'USD'   Limit 1];
          
        CurrencyType__c cTypeEur  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where ISO_Code__c = 'EUR' Limit 1];
          
        CurrencyType__c cTypeAud  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where ISO_Code__c = 'AUD' Limit 1];
          
        /*INDIAN RUPEE*/
        for(Opportunity opp : OppQry){
        
            opportunity op = new Opportunity(Id = Opp.Id);
            
            if(opp.Currency__c == 'INR'){
                op.usd_amount1__c = opp.Amount * cTypeInr.Conversion_Rate__c;
            } 
            if(opp.Currency__c  == 'USD'){
                op.usd_amount1__c = opp.Amount * cTypeUsd.Conversion_Rate__c;
            //oppList.add(op);
            }  
            if(opp.Currency__c  == 'EURO'){
                op.usd_amount1__c = opp.Amount * cTypeEur.Conversion_Rate__c;
            } 
            if(opp.Currency__c  == 'AUD'){ 
                op.usd_amount1__c = opp.Amount * cTypeAUD.Conversion_Rate__c;            
            }
            oppList.add(op);
        }
        
        if(oppList.size() > 0){
            update opplist;
        }
        
   }

}

Regards,

Soundar Raj
+91-741842418​
Hi,

I need to update Opportunities SUM(Amount) in Account field (Total_Opportunities_Amount__c) .

So i have create a small trigger as below. Now i am getting size of opportunities, right now i need  SUM,AVG,MIN & MAX of Opportunities (i can update in account fields__c). Please review my code and advice me once how can we achieve this process.

 
trigger ContactRollUp on Contact (after insert, after update,after delete) {
 

    
   List<Id> conList = New List<Id>();
    
    if(Trigger.isInsert || Trigger.isUndelete){
        for(Contact con : Trigger.new){
            conList.add(con.accountId);
        }
    }

    if(Trigger.isdelete){
        for(Contact con : Trigger.old){
            conList.add(con.accountId);
        }
    }
    
    List<Account> accList = New List<Account>();
    
    List<aggregateResult> opp = [Select  SUM(amount) sumAmt from opportunity];
    
    For(Account acc : [Select id,name, (Select id,amount from opportunities) from Account Where id =:conList]){
                //acc.Number_Of_Contacts__c = acc.Contacts.size();
               acc.Total_Opportunities__c = acc.Opportunities.size();   // Number Of Opp
               // acc.Opportunity_Total_Amount__c  = acc.opportunities.SUM(amount);
               accList.add(acc);
    } 
    
    if(accList.size() > 0){
        
        update accList;
    }
}

Regards,

Soundar Raj,
+91- 7418425418​
Hi ,

I have follow requirement ... 

Create utility class to manage currency rate and Write trigger to fetch the currency value by passing currency("USD") as input.

I am new to development , little struggling while create a class.

Could anyone please give me  a sample code of ' utility class to manage currencey rate '
Dear Friends,

Let me know how can we compare with old map Id For Below Code

*********************************************************************************
 
trigger QuoteLineItemUpdateOnOpp on Quote (after insert,after Update) {
    
    IF(Trigger.isAfter && Trigger.isInsert){
    Set<ID> qtId = New Set<Id>();
    Set<Boolean> syn = New Set<Boolean>();
    Set<Id> OppId =  New Set<Id>();
    List<OpportunityLineItem> lItem = New  List<OpportunityLineItem>();
    for(Quote q : Trigger.new){
        qtId.add(q.Id);
        syn.add(q.Custom_Synchronize__c);
    }
    //Quote qt=trigger.new[0];
    //Quote qt = New Quote();
    IF(qtId.size() > 0){
        System.debug('Quote Size : ' + qtId.size());
       // List<Quote> qtList = [Select id,name from Quote Where ID =:qtId];
        List<Quote_Line_Item__c> qtLItem = [Select Id,name,Quantity__c,Price__c,Quotes__c,Quotes__r.Opportunity.Id, Products__c from Quote_Line_Item__c
                                           Where Quotes__c IN :qtId];
        System.debug('Quote Line Item Size : ' + qtLItem.size());
        System.debug('Checking a Quote LineItem : ' + qtLItem);
         
        //List<Opportunity> oppty = New List<Opportunity>();
        List<Opportunity> oppList = [Select id,name,CloseDate,(Select id,name,ListPrice from OpportunityLineItems) From Opportunity Where ID IN :oppId];
        
        //Update QuoteLineItem To OpportunityLine Item
        
        
        For(Quote_Line_Item__c qteLineItem  : qtLItem){
            OpportunityLineItem OppLItem = New OpportunityLineItem();
            
            OppLItem.Id = qteLineItem.Quotes__r.id;
            OppLItem.UnitPrice = qteLineItem.Price__c;
            OppLItem.Quantity = qteLineItem.Quantity__c;
            OppLItem.PricebookEntryId = qteLineItem.Products__c;
            lItem.add(OppLItem);
        }
        
        if(lItem.size() > 0){
            
            update lItem;
        }
        
    } 
}   
    
}







*******************************************


Thanks IN Advance

Regards,
SOUNDAR RAJAN P

Dear Friends,

Can Anyone help to develop below requirement..

1). Need to update Opportunity line Item , from quote Line Item (Created a Custom Object) . It's related list in Quote.
2).I have created a new checkbox (Synchronize) in quote . 
3). Above process could be done when i enabled the synchronize Checkbox.


I am new to the development so i am expecting well developer's help.


Thanks in advance..

Regards,

Soundar Raj
+91-7418425418

I got a below Error when i try to update account address (Billing Address) to Contact Address (Mailing Address)

************************************************************************************
 
trigger ContactMapToAccount on Contact (after Insert ) {
      List<Contact> lsCon = New List<Contact>();
    System.debug('Starting ++');
    //Set Of Id In Contact Code & Id
    Set<Id> conId = New Set<Id>();
    Set<String> conCode = New Set<String>();
    
    for(Contact c : Trigger.New){
         if(c.Account_Code__c != Null){
        conId.add(c.Id);
        conCode.add(c.Account_Code__c);
         } 
    }
    if(conCode.size() > 0)  {    
     System.debug('ContactId : ' + conId);
    
    List<Contact> lstCont = [Select id, Account_Code__c, name, MailingAddress, OtherAddress from Contact Where ID IN:conId];
    System.debug('Contact : ' + lstCont);
    
    List<Account> lstAcc  =[Select id,Account_Code__c, name,Phone,BillingAddress,ShippingAddress from Account Where Account_Code__c IN:conCode];
    System.debug('Account : ' + lstAcc);
    
    Map<String,Account> acMap = new Map<String,Account>();
    for(Account a : lstAcc){
        acMap.put(a.Account_Code__c, a);
    }
    
   /* Map<Id,Contact> conMap =  New Map<Id,Contact>();
    for(Contact c : lstCont){
        conMap.put(c.Id, c);
    }*/
   
    for(Contact c : lstCont){
        if(c.Account_Code__c != Null){
            Contact cont = New Contact(id = c.id);
        cont.AccountId = acMap.get(c.Account_Code__c).id;
        cont.phone = acMap.get(c.Account_Code__c).Phone;
        cont.Fax = acMap.get(c.Account_Code__c).Fax;   
        cont.MailingAddress = acMap.get(c.Account_Code__c).BillingAddress;     // Error Line
        lsCon.add(cont);    
    } 
        
   }
    if(lsCon.size() > 0){
        
        update lsCon;
    }
  }  
}

 
I am trying to update a contact based on accout Code not a account name (field of contact). this Account code is available in Account.
When i create a new contact i will give a account code , at that time account name need to update based on this account code only...

Here is the following Code, can you please give me a proper trigger for this process

********************************************************************************
trigger ContactMapToAccount on Contact (before insert , before update) {
     
    //Set Of Id In Contact Code & Id
    Set<Id> conId = New Set<Id>();
    Set<Id> conCode = New Set<Id>();
    for(Contact c : Trigger.New){
        conId.add(c.Id);
        
    }
    
    List<Contact> lstCont = [Select id, Account_Code__c, name from Contact Where ID IN :conId];
    Map<Id,Account> acMap = new Map<Id,Account>();
    for(Account a : lstCont){
        acMap.put(a.id, a);
        
    }
    
    for(Contact c : lstCont){
        
        c.Account_Code__c = acMap.get(a.Account_Code__c);
    }
}


**************************

Thnaks in advance
 Dear Friends,

Can Anyone explain Why this error was showing here ...

trigger ExampleTrigger on Contact (after insert, after delete) {
    if (Trigger.isInsert) {
        Integer recordCount = Trigger.New.size();
        // Call a utility method from another class
        EmailManager.sendMail('Your email address', 'Trailhead Trigger Tutorial', 
                    recordCount + ' contact(s) were inserted.');

    }
    else if (Trigger.isDelete) {
        // Process after delete
    }
}


Error : Variable does not exist: EmailManager


Thanks In Advance ..
Hi Friends,
I am new to the development, Could You Please Anyone cover a test class for below trigger.


-----------------------Code  ----------------------

trigger OI_AgentLogin_FIFOInit on Agent_Availability_Log__c(after Insert, after Update){
    
    // Active Complaint
    Boolean m_CNsetup = false;  

    // Get current profile custom setting.
    Trigger_Controller__c m_CNprofile = Trigger_Controller__c.getvalues(UserInfo.getProfileId()); 
    // Get current Organization custom setting.
    Trigger_Controller__c m_CNOrg = Trigger_Controller__c.getvalues(UserInfo.getOrganizationId());
    // Get current User custom setting.
    Trigger_Controller__c m_CNuser = Trigger_Controller__c.getValues(UserInfo.getUserId());

    if(m_CNuser != null) {
        m_CNsetup = m_CNuser.OI_AgentLogin_FIFOInit__c;
    } 
    else if(m_CNprofile != null) {
        m_CNsetup = m_CNprofile.OI_AgentLogin_FIFOInit__c;
    }
    else if(m_CNOrg != null) {
        m_CNsetup = m_CNOrg.OI_AgentLogin_FIFOInit__c;
    }

    if(!m_CNsetup){
        return;
    }
    
    set<string> st_MgrID = new set<string>(); // Set of Group Manager Id
    set<string> st_RTId = new set<string>(); // Set of Record Type Id
    map<string, list<case>> mp_CasLs2CasOrg = new map<string, list<case>>(); // Mapping List of Case to Case Origin
    Set<string> st_CasOrg = new Set<string>(); // Set of Case Origin
    
    for(Agent_Availability_Log__c irow : trigger.new){
        If(trigger.isInsert && irow.Date__c == System.Today() && irow.IsAvailable__c && irow.Group_Member__r.FIFO_Case_Count__c == 0){
            st_MgrID.add(irow.Assignment_Group__r.Manager__r.id);            
        }
        
        if(trigger.isUpdate && irow.Date__c == System.Today() && irow.IsAvailable__c && irow.Group_Member__r.FIFO_Case_Count__c == 0){
            st_MgrID.add(irow.Assignment_Group__r.Manager__r.id);
        }
    }
    
    if(st_MgrID.size()>0){
        for(Schema.RecordTypeInfo irow : Schema.SObjectType.Case.getRecordTypeInfosByName().values()){
            if(irow.getName() == 'Parent' || irow.getName() == 'Child'){
                st_RTId.add(string.valueof(irow.getRecordTypeId()));
            }
        }
        system.debug(' st_RTId ' + st_RTId);
        
        for(case irow : [Select Id, CaseNumber, Email__c, Origin, OwnerId, OwnerId__c, CreatedDate FROM Case WHERE OwnerId IN: st_MgrID AND IsFIFOAssigned_Agent__c = FALSE AND IsFIFOAssigned_Mgr__c = TRUE AND RecordTypeId IN: st_RTId]){
            AssignGroupName_ModeofAssignment__c Asg = AssignGroupName_ModeofAssignment__c.getvalues(irow.Origin);
            if(Asg.Mode_of_Assignment__c == 'FIFO' && !irow.IsFIFOAssigned_Agent__c && irow.IsFIFOAssigned_Mgr__c){
                if(mp_CasLs2CasOrg.containsKey(irow.Origin)){
                    list<case> Tmp = mp_CasLs2CasOrg.get(irow.Origin);
                    Tmp.add(irow);
                    mp_CasLs2CasOrg.put(irow.Origin, Tmp);
                }else{
                    list<case> Tmp = new list<case>();
                    Tmp.add(irow);
                    mp_CasLs2CasOrg.put(irow.Origin, Tmp);
                }
                st_CasOrg.add(irow.Origin);
            }
        }
        System.debug('st_CasOrg ## i'+st_CasOrg);
        system.debug(' mp_CasLs2CasOrg ### ' + mp_CasLs2CasOrg);
    }
    
    if(St_CasOrg.size() > 0){
        // FIFO
        OI_FIFOAssignment fifo = new OI_FIFOAssignment(St_CasOrg, mp_CasLs2CasOrg);fifo.Assign();
    }
}




Thanks In Advance

Regards,
Soundar Raj.
Hi Friends,
I am new to the development, can you please explain how can i cover a test class for trigger as well.


-----------------------Code  ----------------------

trigger OI_AgentLogin_FIFOInit on Agent_Availability_Log__c(after Insert, after Update){
    
    // Active Complaint
    Boolean m_CNsetup = false;  

    // Get current profile custom setting.
    Trigger_Controller__c m_CNprofile = Trigger_Controller__c.getvalues(UserInfo.getProfileId()); 
    // Get current Organization custom setting.
    Trigger_Controller__c m_CNOrg = Trigger_Controller__c.getvalues(UserInfo.getOrganizationId());
    // Get current User custom setting.
    Trigger_Controller__c m_CNuser = Trigger_Controller__c.getValues(UserInfo.getUserId());

    if(m_CNuser != null) {
        m_CNsetup = m_CNuser.OI_AgentLogin_FIFOInit__c;
    } 
    else if(m_CNprofile != null) {
        m_CNsetup = m_CNprofile.OI_AgentLogin_FIFOInit__c;
    }
    else if(m_CNOrg != null) {
        m_CNsetup = m_CNOrg.OI_AgentLogin_FIFOInit__c;
    }

    if(!m_CNsetup){
        return;
    }
    
    set<string> st_MgrID = new set<string>(); // Set of Group Manager Id
    set<string> st_RTId = new set<string>(); // Set of Record Type Id
    map<string, list<case>> mp_CasLs2CasOrg = new map<string, list<case>>(); // Mapping List of Case to Case Origin
    Set<string> st_CasOrg = new Set<string>(); // Set of Case Origin
    
    for(Agent_Availability_Log__c irow : trigger.new){
        If(trigger.isInsert && irow.Date__c == System.Today() && irow.IsAvailable__c && irow.Group_Member__r.FIFO_Case_Count__c == 0){
            st_MgrID.add(irow.Assignment_Group__r.Manager__r.id);            
        }
        
        if(trigger.isUpdate && irow.Date__c == System.Today() && irow.IsAvailable__c && irow.Group_Member__r.FIFO_Case_Count__c == 0){
            st_MgrID.add(irow.Assignment_Group__r.Manager__r.id);
        }
    }
    
    if(st_MgrID.size()>0){
        for(Schema.RecordTypeInfo irow : Schema.SObjectType.Case.getRecordTypeInfosByName().values()){
            if(irow.getName() == 'Parent' || irow.getName() == 'Child'){
                st_RTId.add(string.valueof(irow.getRecordTypeId()));
            }
        }
        system.debug(' st_RTId ' + st_RTId);
        
        for(case irow : [Select Id, CaseNumber, Email__c, Origin, OwnerId, OwnerId__c, CreatedDate FROM Case WHERE OwnerId IN: st_MgrID AND IsFIFOAssigned_Agent__c = FALSE AND IsFIFOAssigned_Mgr__c = TRUE AND RecordTypeId IN: st_RTId]){
            AssignGroupName_ModeofAssignment__c Asg = AssignGroupName_ModeofAssignment__c.getvalues(irow.Origin);
            if(Asg.Mode_of_Assignment__c == 'FIFO' && !irow.IsFIFOAssigned_Agent__c && irow.IsFIFOAssigned_Mgr__c){
                if(mp_CasLs2CasOrg.containsKey(irow.Origin)){
                    list<case> Tmp = mp_CasLs2CasOrg.get(irow.Origin);
                    Tmp.add(irow);
                    mp_CasLs2CasOrg.put(irow.Origin, Tmp);
                }else{
                    list<case> Tmp = new list<case>();
                    Tmp.add(irow);
                    mp_CasLs2CasOrg.put(irow.Origin, Tmp);
                }
                st_CasOrg.add(irow.Origin);
            }
        }
        System.debug('st_CasOrg ## i'+st_CasOrg);
        system.debug(' mp_CasLs2CasOrg ### ' + mp_CasLs2CasOrg);
    }
    
    if(St_CasOrg.size() > 0){
        // FIFO
        OI_FIFOAssignment fifo = new OI_FIFOAssignment(St_CasOrg, mp_CasLs2CasOrg);fifo.Assign();
    }
}



--------------------------------------------------------------

*Could You Please Cover above trigger
*Please Explain 

Thanks In Advance

Regards,
Soundar Raj.
Dear friends,

How can i cover following line in test class.

Public Boolean isShowOpp {get;set;}   //  This line is not covering in the test class.

Thanks in advance.

Regards,
Soundar Raj
Hi Friends,

I getting small problem while covering a test class. I am not able to call one method from controller to testclass. Could you please help to me.

------------------------------------------      Controller       -----------------------------------------


public with sharing class AccountDealOpportunity {

    public AccountDealOpportunity(ApexPages.StandardController controller)    // I Want to call This method

        
        lstOpp = new List<Opportunity__c>();
        AccId = ApexPages.currentPage().getParameters().get('id');
        Account iAcc = [SELECT id, Recordtype.Name, Name FROM Account WHERE Id =: AccId];
        String Query = 'SELECT id, Name, Originator__c, Investor__c, Interested_Products__c, Asset_Class__c, Investor_Category__c,'+
                        +'Amount__c,Valid_Till__c,RecordType.Name FROM Opportunity__c where ';
        if(iAcc.RecordType.Name == 'Investor')
        {
            query = query + 'Investor__c =: AccId';
        }
        else if(iAcc.RecordType.Name == 'Originator')
        {
            query = query + 'Originator__c =: AccId';
        }
        lstOpp = Database.query(query);
    }


    public List<Opportunity__c> lstOpp {get;set;}
    Public Boolean isShowOpp {get;set;}
    String AccId;
    
    public AccountDealOpportunity()
    {
        
    }
    
    public pageReference CreateDeal()
    {
        PageReference DealPage = new PageReference('/apex/CreateDeals?id=' + AccId);
        DealPage.setRedirect(true);
        return DealPage;
    }
    
    public pageReference OpportunitytoDeal()
    {
        return Null;
    }

}



-------------------------------------------------   Test Class   --------------------------------

/*-------------------------------------------------
Created Date  : 10/05/2017
Refered Class : AccountDealOpportunity.
------------------------------------------------- */

@IsTest(SeeAllData = True)
public class AccountDealOpportunityTest{

public static testMethod void AccountDealMethod(){
String AccId;
//List<Opportunity__c> lstOpp = new List<Opportunity__c>();

AccId = ApexPages.currentPage().getParameters().get('id');
   
    
    
/*Account Duplicate Values Fixed */
Account acc = New Account();
acc.Name = 'Test Account';
//acc.Recordtype.Name = 'Originator';
insert acc;

 /* String Query = 'SELECT id, Name, Originator__c, Investor__c, Interested_Products__c, Asset_Class__c, Investor_Category__c,'+
                        +'Amount__c,Valid_Till__c,RecordType.Name FROM Opportunity__c where ';
                        
   if(acc.RecordType.Name == 'Investor')
        {
            query = query + 'Investor__c = 00Np0000001FjCGEA0';
        }
        else if(acc.RecordType.Name == 'Originator')
        {
            query = query + 'Originator__c = 00Np0000001FjCL';
        }
           */                     


/*Opportunity Duplicate Values Fixed */
Opportunity__c opp = New Opportunity__c();
opp.name = 'Test Opportunity';
//opp.Originator__c = '00Np0000001FjCL';
//opp.Investor__c   = '00Np0000001FjCGEA0';
opp.Interested_Products__c = 'Term Loan';
opp.Asset_Class__c ='AHF';
opp.Investor_Category__c = 'NBFC';
opp.Amount__c = 1000;
opp.Valid_Till__c = date.parse('11/6/2017');
//opp.RecordType.Name = 'Originator';

insert opp;

AccountDealOpportunity accts = New AccountDealOpportunity();
accts.CreateDeal();
accts.OpportunitytoDeal();
//accts.AccountDealOpportunity();
AccountDealOpportunity(ApexPages.StandardController controller)  //
}
}


Error: Compile Error: expecting a right parentheses, found 'controller' at line 55 column 58



Many Thanks In Advance ......

Regards,
Soundar Rajan P
7418425418
Dear friends,

I am new to the development , could you please cover the test class for following code with explaination.

Code
---------------------------------------------------------------------------------

public with sharing class AccountDealOpportunity {

    public AccountDealOpportunity(ApexPages.StandardController controller) {
        
        lstOpp = new List<Opportunity__c>();
        AccId = ApexPages.currentPage().getParameters().get('id');
        Account iAcc = [SELECT id, Recordtype.Name, Name FROM Account WHERE Id =: AccId];
        String Query = 'SELECT id, Name, Originator__c, Investor__c, Interested_Products__c, Asset_Class__c, Investor_Category__c,'+
                        +'Amount__c,Valid_Till__c,RecordType.Name FROM Opportunity__c where ';
        if(iAcc.RecordType.Name == 'Investor')
        {
            query = query + 'Investor__c =: AccId';
        }
        else if(iAcc.RecordType.Name == 'Originator')
        {
            query = query + 'Originator__c =: AccId';
        }
        lstOpp = Database.query(query);
    }


    public List<Opportunity__c> lstOpp {get;set;}
    Public Boolean isShowOpp {get;set;}
    String AccId;
    
    public AccountDealOpportunity()
    {
        
    }
    
    public pageReference CreateDeal()
    {
        PageReference DealPage = new PageReference('/apex/CreateDeals?id=' + AccId);
        DealPage.setRedirect(true);
        return DealPage;
    }
    
    public pageReference OpportunitytoDeal()
    {
        return Null;
    }

}

------------------------------------------------------------------------


Thanks In Advance ....

Regards,
Soundar Raj
create VF page for importing the excel sheet to Salesforce. 
 
Please don’t use the Apex and everything should in VF page.


Note: If CSV file having Id , it should update the old record's .
If don't have an Id it's should create a new record in salesforce.


Thanks In Advance.
Dear Friends,

I believe you can solve this Problem.

I want to manage more documents in my server by unsing a PHP open source Document Management System. 

Could you please give me the accurate answer.

I tried by using like Opendocman,Seed DMS But my Client expecting like following.

1. Want to upload this document .
2.  need admin and user level accept. (upload a file from admin and need to create an another user to view this page)
3. adminn only can delete or make edit in this page.
4. Client is expecting that software need in PHP.
Hi Friends ,

How can i display the date format like 21st October 2016 .

Here i my origional coding 

<apex:outputtext value="{0, date,dd' 'MMMM' 'YYYY}">
      <apex:param value="{!Inspection_Sheet__c.Date__c}">
      </apex:param>
</apex:outputtext>

Output Is : 25 October 2016

Could you please help me , how can i display this format on visualforce page 25th october 2016

Many Thanks in Advance...!!!

Regards ,
Soundar ,
Hi Friends,

I need some accurate solution in date format, i think it's easy to salesforce developer . but i am new to salesforce .

I dispalyed  the date format like below 

 <apex:outputtext value="{0, date, medium}">
        <apex:param value="{!Inspection_Sheet__c.Date__c}"></apex:param>
    </apex:outputtext>

Output Is : Oct 21,2016

But I need a output like this --> 21st Oct 2016

Can Anyone help to me ASAP. 

I will be appreciate if you are come with the best solution .

Many Thanks In advance !!

Regards ,

SOUNDAR ,

+91-7418425418.
Hi Guys,

I need to send Email alert for today created contacts list . 
Contact records are inserted through automation. Manager expecting in single mail to fetch list of contact records creted by today .
Can you please guide me , how to i achive this ? 


Ex:Email template 

HI Manger,
Today Contact records listed below .

ID   name         mail                        phone    createddate
001  sasi         sasi@gmail.com       123         today
002   sachin     sacina@gmai.com    234         today
003  sehwag     sehwag@gmail.com  345        today

Thanks& Regards,
Sasidhar



















  
 
Hi All,

I am trying to calculate the time spent on each staff. I have taken 2 datetime fields and 3rd field to calulate time spent for each staff. 

What I am trying to do is : When record is getting created that time,status is 'NEW' and setting the 1st field to NOW(). Now on staff change and status not equals to 'NEW', updating fields i.e the 2nd datetime field to NOW(),Then calulating the timespent: 2nd datetime - 1st datetime and again
setting the 1st datetime field to NOW(). 

But the problem is while updating 3 fields at a time. The 2nd datetime field should be updated at the last but it is updating before calculating the time spent.

So, how to proceed with it. Please suggest for the same.

Thanks!
I see a lot of resoitces online to convert an unmanaged package to a managed one. Do we have the ability to convert a managed package to an unmanaged one?
  • June 20, 2017
  • Like
  • 0
How to add inline edit to VF page and pagination function? (for Title,Email and Birthdate)

Thanks!
 
<apex:page Controller="AccContact">
  <apex:form >
      
      <apex:pageBlock >
  <apex:pageBlockTable value="{!acclst}" var="a">
      
   
 <apex:column headerValue="Name">
  <apex:commandLink action="{!selacc}">
  <apex:param name="conlst" value="{!a.id}"/>
  <apex:outputText value="{!a.name}"/>
  </apex:commandlink>
  </apex:column>
  <!--accounts-->
   </apex:pageBlockTable>
    <apex:pageBlockTable value="{!accconts1}" var="a">
    <apex:column headerValue="Account Name" value="{!a.Name}"/>
    <!--contacts-->
    <apex:column headerValue="List contacts">
   <apex:pageBlockTable value="{!a.contacts}" var="c">
       
          <apex:column headerValue="Title">
  <apex:outputText value="{!c.title}"></apex:outputText>
  </apex:column>
  
       
    <apex:column headerValue="First Name">
  <apex:outputText value="{!c.firstname}"></apex:outputText>
  </apex:column>
       
  <apex:column headerValue="Last Name">
  <apex:outputText value="{!c.lastname}"></apex:outputText>
  </apex:column>
   
   <apex:column headerValue="Email">
  <apex:outputText value="{!c.email}"></apex:outputText>
  </apex:column>

     <apex:column headerValue="Birthdate">
  <apex:outputText value="{!c.birthdate}"></apex:outputText>
  </apex:column>
       
  
 </apex:pageBlockTable> <!-- End contact-->
 </apex:column>
 </apex:pageBlockTable><!--end account-->
  </apex:pageBlock>
         

  </apex:form>
</apex:page>
 
public with sharing class AccContact {

    public list<contact> conlst { get; set; }

   // public contact c { get; set; }
   /* public  void getSelacc() {
    }*/

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

    public PageReference selacc() {
    string getid=apexpages.currentpage().getparameters().get('conlst');
         accconts1=[select id,name,(select id,lastname,firstname,email,title,birthdate from contacts)  from account where id=:getid ];
            system.debug(accconts1);
      return null;
    }


    public List<Account> acclst { get; set; }
   public  AccContact (){
     acclst=[select id,name  from account ];
     system.debug(acclst);
   
   }

}


       

 
Hello

I have successfully installed the Know Your Enemy App from AppExchange by Salesforce Labs however, the News and Twitter Feeds don't work.  These are Visualforce pages.  Does anyone know how I can fix this?  

Many thanks in advance.
Dear Friends,

Could anyone give a Clear explaination the main difference between before insert & Update , after Insert & Update with good Example.

Regards,

Soundar.
Hi All,
I am new to the salesforce, i have a requirement like,

i have case standard page layout and custom picklist filed having values (A and B), if i select the option and click save the record will saved and one vf page will open in that vf page i have two options and one button if i select anyone option and click next button then it will open the another vf page in that page i have two fields and one button anyone option is selected and i click the save button it would the contact record that what are values given in pages that values will populate in that case record.

Please let met is any way to achieve this requirement.
Thanks in advance.
i want to create Opportunity and opportunitylineitem porducts using flow and process builder but i am getting  error in debug log it say Action name not found or null but i can not understand what is action name stands for? 
I have one Custom Email temple there I am currently uploading My Computer Documents,here we already uploaded some files into salesforce, How Can Send Salesforce files Attaching with Custom Email Template, (I need salesforce files selecting option in that custom Email Template) Moreover what i need the below image shows the option I want that option in my Custom Email template, How Can I do This...????


User-added image
 
Dear friends,

I like to reduce this Query size (four --> single ) . Kindly advise me once how it's possible by using Map
 
public class OppUsdUpdate {
    
    public static void usdUpdate(Id Opportunity, String str){
    
        List<Opportunity> oppList = New List<Opportunity>();
        
                          
        List<Opportunity> oppQry = [Select id, name, USD_Amount1__c,Amount, Currency__c from  Opportunity where Id =:Opportunity];
         
        CurrencyType__c cTypeInr  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where 
                                    ISO_Code__c = 'INR'  Limit 1];
          
        CurrencyType__c cTypeUsd  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where ISO_Code__c = 'USD'   Limit 1];
          
        CurrencyType__c cTypeEur  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where ISO_Code__c = 'EUR' Limit 1];
          
        CurrencyType__c cTypeAud  =[Select id,name,Conversion_Rate__c, ISO_Code__c from CurrencyType__c where ISO_Code__c = 'AUD' Limit 1];
          
        /*INDIAN RUPEE*/
        for(Opportunity opp : OppQry){
        
            opportunity op = new Opportunity(Id = Opp.Id);
            
            if(opp.Currency__c == 'INR'){
                op.usd_amount1__c = opp.Amount * cTypeInr.Conversion_Rate__c;
            } 
            if(opp.Currency__c  == 'USD'){
                op.usd_amount1__c = opp.Amount * cTypeUsd.Conversion_Rate__c;
            //oppList.add(op);
            }  
            if(opp.Currency__c  == 'EURO'){
                op.usd_amount1__c = opp.Amount * cTypeEur.Conversion_Rate__c;
            } 
            if(opp.Currency__c  == 'AUD'){ 
                op.usd_amount1__c = opp.Amount * cTypeAUD.Conversion_Rate__c;            
            }
            oppList.add(op);
        }
        
        if(oppList.size() > 0){
            update opplist;
        }
        
   }

}

Regards,

Soundar Raj
+91-741842418​
best things to remember to write triggers?
I have a VisualForce page that has Two input fields with onchange actions that if I were type a currency value into a field it will update the other input field and then immediately click save will re-calculate and do the onchange event before the save of the record happens. **Mind you if I click out of the field before immediately clicking save it will calculate and save the record.
My VF page:
 
<apex:page standardController="EventPackageRevenueBreakdown__c"
	extensions="EventPackageRevenueBreakdownExt" standardStylesheets="true"
	tabstyle="EventPackageRevenueBreakdown__c" docType="html-5.0">
<apex:form >
		<apex:sectionHeader title="{!$ObjectType.EventPackageRevenueBreakdown__c.label} {!$Label.Edit}"
			subtitle="{!EventPackageRevenueBreakdown__c.Name}"
			help="{!$Label.NIBaseHelpURL}#cshid= event_package_revenue_breakdown_edit">
		</apex:sectionHeader>
		<apex:pageBlock mode="edit"
			title="{!$ObjectType.EventPackageRevenueBreakdown__c.label} {!$Label.Edit}">
			<apex:pageblockbuttons >
				<apex:commandbutton action="{!save}" value="{!$Label.Package_Save}"></apex:commandbutton>
				<apex:commandbutton action="{!SaveAndNew}"
					value="{!$Label.Package_SaveAndNew}"></apex:commandbutton>
				<apex:commandbutton action="{!cancel}"
					value="{!$Label.Package_Cancel}"></apex:commandbutton>
			</apex:pageblockbuttons>
			<apex:pagemessages ></apex:pagemessages>
			<apex:pageblocksection title="{!$Label.Package_Information}"
				id="block123">
				<apex:actionFunction name="UpdateInclusivePrice"
					action="{!UpdateInclusivePrice}" rerender="block123"></apex:actionFunction>
				<apex:actionFunction name="UpdateUnitPrice"
					action="{!UpdateUnitPrice}" rerender="block123"></apex:actionFunction>
				<apex:actionFunction name="CalculateInclusive"
					action="{!CalculateInclusive}" rerender="block123"></apex:actionFunction>
				<apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
				<apex:inputField required="false" value="{!EventPackageRevenueBreakdown__c.UnitPrice__c}"
					label="{!IF(showInclusivePrices, $Label.ExclPrice, $ObjectType.EventPackageRevenueBreakdown__c.fields.UnitPrice__c.label)}"
					 onchange="UpdateInclusivePrice()" onkeypress="enterPress(event, 'inclusive')">
				</apex:inputField>
				<apex:inputfield required="false"
					value="{!EventPackageRevenueBreakdown__c.Location__c}"></apex:inputfield>
				<apex:pageBlockSectionItem rendered="{!NOT(showInclusivePrices)}">
				</apex:pageBlockSectionItem>
				<apex:pageBlockSectionItem rendered="{!showInclusivePrices}">
					<apex:outputLabel value="{!$Label.InclPrice}"></apex:outputLabel>
					<apex:inputField required="false" styleClass="test" value="{!EventPackageRevenueBreakdown__c.InclusiveUnitPrice__c}"
						onChange="UpdateUnitPrice()" onkeypress="enterPress(event, 'exclusive')"></apex:inputField>
				</apex:pageBlockSectionItem>
				<apex:outputfield value="{!EventPackageRevenueBreakdown__c.BookingPackageEvent__c}" />
			<apex:pageblocksectionitem >
					<apex:outputlabel >{!$ObjectType.EventPackageRevenueBreakdown__c.fields.RevenueClassification__c.label}</apex:outputlabel>
					<apex:outputpanel layout="block" styleClass="requiredInput">
						<apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
						<apex:inputfield value="{!EventPackageRevenueBreakdown__c.RevenueClassification__c}"
							onChange="CalculateInclusive()">
						</apex:inputfield>
					</apex:outputpanel>
				</apex:pageblocksectionitem>
			</apex:pageblocksection>
			<apex:pageblocksection title="{!$Label.AdminChargeAndGratuity}">
				<apex:inputfield required="false"
					value="{!EventPackageRevenueBreakdown__c.AdminCharge__c}"
					onChange="CalculateInclusive()"></apex:inputfield>
				<apex:inputfield required="false"
					value="{!EventPackageRevenueBreakdown__c.Gratuity__c}"
					onChange="CalculateInclusive()"></apex:inputfield>
			</apex:pageblocksection>
			<apex:pageblocksection title="{!$Label.InclusivePrice}"
				rendered="{!showInclusivePrices}" collapsible="true">
				<apex:inputcheckbox value="{!EventPackageRevenueBreakdown__c.AdminIsIncludedInInclusivePrice__c}"
					onChange="CalculateInclusive()"></apex:inputcheckbox>
				<apex:inputcheckbox value="{!EventPackageRevenueBreakdown__c.GratuityIsIncludedInInclusivePrice__c}"
					onChange="CalculateInclusive()"></apex:inputcheckbox>
			</apex:pageblocksection>
		</apex:pageBlock>
		<apex:actionFunction name="saveInclusive" action="{!saveFromEnterInclusive}"></apex:actionFunction>
		<apex:actionFunction name="saveUnit" action="{!saveFromEnterUnit}"></apex:actionFunction>
	</apex:form>
	<script>
	function enterPress(e, fields)
	{
		if(e.keyCode==13)
		{
			if(e.preventDefault)
			{ 
            	e.preventDefault();
            }
            if(fields == 'inclusive')
            {
            	saveInclusive();
           }
           else
           {
           		saveUnit();
           }
        }        
    }</script>
</apex:page>

My standard Controller
 
public with sharing class EventPackageRevenueBreakdownExt {
    public boolean showInclusivePrices { get; set; }
    
    private ApexPages.standardController sController;
    private decimal price;
    private decimal inclusivePrice;
    private Id taxGroupId;
    private EventPackageRevenueBreakdown__c eprb;
    private QueryTaxGroupSchedule qtgs;
    public EventPackageRevenueBreakdownExt(ApexPages.standardController stdController) {

            //Set showInclusivePrices based on feature toggle
            if (Test.isRunningTest()) {
                showInclusivePrices = true;
            } else {
                NiPublic__c niSettings = NiPublic__c.getOrgDefaults();
                if (niSettings != null) {
                    showInclusivePrices = niSettings.EnableInclusivePrices__c;
                } else {
                    showInclusivePrices = false;
                }
                stdController.addFields(new list<string>{'UnitPrice__c'});
            }
            
            sController = stdController;
            eprb = (EventPackageRevenueBreakdown__c) sController.getRecord();
            
            if(eprb.UnitPrice__c == null){ 	
			eprb.UnitPrice__c = 0.00;}
			
			price = eprb.UnitPrice__c;			
			
            if (ApexPages.currentPage().getParameters().get('BookingPackageEventId') != null) {
                eprb.BookingPackageEvent__c = ApexPages.currentPage().getParameters().get('BookingPackageEventId');
            }

            if (eprb.BookingPackageEvent__c != null) {
            	BookingPackageEvent__c bookingPackageEvent = [Select Location__c, BookingEvent__r.TaxGroup__c From BookingPackageEvent__c Where Id = :eprb.BookingPackageEvent__c Limit 1];
                eprb.Location__c = bookingPackageEvent.Location__c;
                taxGroupId = bookingPackageEvent.BookingEvent__r.TaxGroup__c;
                qtgs = new QueryTaxGroupSchedule(taxGroupId, false);          
            }

            if (eprb.Name == null) {
                eprb.Name = '{AUTO}';
            }
           
            CalculateInclusive();           
    }

    public Pagereference SaveAndNew() {
    	
    	if(this.save() == null){
    		return null;
    	}
    	
        PageReference pageRef = page.NewEventPackageRevenueBreakdown;
        pageRef.getParameters().put('BookingPackageEventId', eprb.BookingPackageEvent__c);
        pageRef.setRedirect(true);
        return pageRef;
    }
    
    public pageReference save() {
    	
    	//throw new ni.niException(string.valueOf(eprb.UnitPrice__c));
    	
        // if the recipient revenue classification is null, add an error to the field
        // and return null to remain on the current page...
        if(eprb.RevenueClassification__c == null) {
            eprb.RevenueClassification__c.addError(label.MustEnterValue);
            return null;
        }
        else {
        	eprb.InclusiveUnitPrice__c = null;
        	eprb.UnitPrice__c = price;
            return sController.save();
        }
    }

    public Pagereference DeleteRecord() {
        string bkgPkgEventId = eprb.BookingPackageEvent__c;
        delete(eprb);
        if (bkgPkgEventId != null) {
            return(new PageReference('/' + bkgPkgEventId));
        } else {
            return(new PageReference('/'));
        }
    }

    public decimal getTotalRate() {       
        decimal totalRate = qtgs.GetInclusiveBaseRate(taxGroupId, eprb.RevenueClassification__c);
        if(eprb.AdminIsIncludedInInclusivePrice__c)
            totalRate += (eprb.AdminCharge__c==null?0: eprb.AdminCharge__c / 100)*(qtgs.GetInclusiveAdminRate(taxGroupId, eprb.RevenueClassification__c));
        if(eprb.GratuityIsIncludedInInclusivePrice__c)
            totalRate += (eprb.Gratuity__c==null?0: eprb.Gratuity__c / 100)*(qtgs.GetInclusiveGratuityRate(taxGroupId, eprb.RevenueClassification__c));
        return totalRate==null?1:totalRate;
    }
 
    public void UpdateInclusivePrice() {
    	price = eprb.UnitPrice__c;	 	 
        CalculateInclusive();
    }
    
    public void UpdateUnitPrice() {   
    	inclusivePrice = eprb.InclusiveUnitPrice__c;	
    	CalculateExclusive();      
    }
    
    public pagereference SaveFromEnterInclusive() {
		UpdateInclusivePrice(); 
		return save();
	}
	
	public pagereference SaveFromEnterUnit() {
		UpdateUnitPrice();
		return save();
	}
    
    public void CalculateInclusive() {
    	inclusivePrice = (price==null?0:price)*(getTotalRate());
    	eprb.UnitPrice__c = (price==null?0:price.setScale(2, RoundingMode.HALF_UP));
    	eprb.InclusiveUnitPrice__c = (inclusivePrice==null?0:inclusivePrice.setScale(2, RoundingMode.HALF_UP));
    }
    
    public void CalculateExclusive() {
    	price = (inclusivePrice==null?0:inclusivePrice)/(getTotalRate());
        eprb.UnitPrice__c = (price==null?0:price.setScale(2, RoundingMode.HALF_UP));
        eprb.InclusiveUnitPrice__c = (inclusivePrice==null?0:inclusivePrice.setScale(2, RoundingMode.HALF_UP));        
    }

}

Any help would greatly be appreciated. I've tried actionsupport immediate false for the save, sending an onclick event to js when save clicked an attempted to prevent the click event, and using onblur as well.