• Nantha
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies

I have a vf page. Below is the code for it. I have been trying to calculate total amount. In my vf page, users are required to enter

1) Effective Date

2) Expiration Date

3) Number of Boxes

Based on the above input - I want to calculate the total amount. Below is the formula.

 

100/930*(Expiration Date - TODAY)*Number of Boxes

 

How do I create controller and accomodate this formula?

Here is my vf page

<apex:page standardcontroller="Application__c" >
 <apex:form >
  <apex:pageblock >
   <apex:pageblockSection >
    
    
          <apex:inputField value="{!Application__c.Effective_Date__c}"/>
          <apex:inputField value="{!Application__c.Expiration_Date__c}"/>
          <apex:inputField value="{!Application__c.of_Boxes__c}"/>
          

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

 

  • May 07, 2013
  • Like
  • 0

Hey Plz chk the Error i want to display the AggregateResult on my Visualforce page but it is generating Error " Invalid field Email for SObject AggregateResult" the code is given below

public with sharing class searchDuplicate {
   public   AggregateResult[] con{get;set;}
   
   public searchDuplicate()
   {
       find();
   }
    public void find(){
      con = [select Email from Contact group by Email having count(Email) > 1];
        System.debug(con);
    }
}

 and Visual Force code is

<apex:page controller="searchDuplicate">
    <apex:pageBlock title="Searching for Duplicate Contacts Record"> 
    </apex:pageBlock>
    <apex:pageBlock title="Contacts">
        <apex:dataTable value="{!con}" var="c" border="2" cellspacing="5" cellpadding="5">
            <apex:column headerValue="Email" value="{!c['Email']}" />
        </apex:dataTable>
    </apex:pageBlock>     
</apex:page>

 

I have created a site to enter email and password.  The object used is contact, the fields used is contact.email and contact.password__c.

 

After the user enter the email and password, I have already placed to check for the existance of email, blank values etc.

 

I would like to check whether the password entered by the user is the same as what is there in the record corresponding to the email entered.

 

Not sure how to figure the logic.  any body can advice?

Hello, 

 

I have a script that works together with a visualforce page, it is a form. 

The script will take the language in the current page and based on that it will send an email to the a specify service department.

I just use this to get the language 'language = Apexpages.currentPage().getParameters().get('lang');'.


Before that I have a Map ready to accommodate the values: 

 

Map<String, String[]> serviceEmailAddresses = new Map<String, String[]>();

 

So the intention is that depending in the user's current page language to send an email to the correct service department, like I mention before.

If the page language is 'en' the email will go to uk.service@something.com, if the current page language is 'es' the email goes to es.servicio@something.com and so on, these are the languages we use: 'en', 'be', 'es','de', 'fr', 'it', 'nl' and 'pt'.

 

Each of those values have an email assign to it. 

 

public ServiceForm() {
        language = Apexpages.currentPage().getParameters().get('lang');
        if ((language == 'en')&&(serviceType != 'Spare Parts Order')) {
            serviceEmailAddresses.put('en', new String[] {'uk.support@something.com'});
        }else{
       
        serviceEmailAddresses.put('en', new String[] {'uk.serviceparts@something.com'});
        serviceEmailAddresses.put('be', new String[] {'service.benelux@something.com'});
        serviceEmailAddresses.put('es', new String[] {'servicio.tecnico@something.com'});
        serviceEmailAddresses.put('de', new String[] {'kundendienst@something.com'});
        serviceEmailAddresses.put('fr', new String[] {'service.benelux@something.com'});
        serviceEmailAddresses.put('it', new String[] {'assistenzatecnica@something.com'});
        serviceEmailAddresses.put('nl', new String[] {'service.benelux@something.com'});
        serviceEmailAddresses.put('pt', new String[] {'servicio.tecnico@something.com'});
        }        
        if (language != 'be'&& language != 'en' && language != 'es' && language != 'de' && language != 'fr' && language != 'it' && language != 'nl' && language != 'pt') {
            language = 'en';
        }

 At the end we use this to send an email to the service department:

 

 private void sendServiceMail() {
        Messaging.SingleEmailMessage serviceMail = new Messaging.SingleEmailMessage();
        serviceMail.setToAddresses(serviceEmailAddresses.get(language));
        serviceMail.setSenderDisplayName(Label.Sender_Display_Name);
        serviceMail.setReplyTo(noReplyEmail);
        serviceMail.setSubject('' + companyName + ', ' + addressCodeCity + ' - ' + serviceType + ' - ONLINE REQUEST');
        String serviceMailMessage = Label.Email_Subject_Service + ':\n\n';
        serviceMailMessage = serviceMailMessage + setPlainTextMessage('\n\n');
        serviceMail.setPlainTextBody(serviceMailMessage);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { serviceMail });        

 The third line I believe is correct, can anyone let me know otherwise?: 

                  serviceMail.setToAddresses (serviceEmailAddresses.get(language)); 

 

 The form works fine but for some unknown reason, sometimes it sends emails to the wrong inbox. Last time a client from Spain submitted his form     and it went to the uk.serviceparts address!! 

 Does anyone knows why this is happening? The script looks pretty straightforward ... 

 

Any help on this will be much appreciated. 

Thanks