• Mia P
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 5
    Questions
  • 4
    Replies
Hi All,
I am trying to create my first VF page and Controller class. I need help for further enhancements please.

User-added image

I need help with the following:
  1. When I hit that "Back" command button - it should redirect to a custom object page, lets say - "Employee__c".
  2. Also, a custom page message should come up if any of the numbers/ text not filled (please see screenshot).
  • where and how to add the following:
     if(firstNumber == '' || firstNumber == null || secondNumber == '' || secondNumber == '')
          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter First and Second numbers'));
Please look into the below code for VF Page and Class and help me with the code. Thanks.

VF Page:
<apex:page controller="firstcls">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockButtons location="top">
              <apex:commandButton value="Add" action="{!Addnumbers}"/>
              <apex:commandButton value="Subtract" action="{!SubtractNumbers}"/>
              <apex:commandButton value="Multiply" action="{!Multiplynumbers}"/>
              <apex:commandButton value="Divide" action="{!Dividenumbers}"/>
              <apex:commandButton value="Back" action="{!getBack}"/> //Not sure if, its right or wrong?
             
          </apex:pageBlockButtons>
          <apex:pageBlockSection >
              <apex:outputLabel value="Enter First Number"/>
              <apex:inputtext value="{!firstNumber}"/>
              <apex:outputLabel value="Enter Second Number"/>
              <apex:inputtext value="{!secondNumber}"/>
              
              <apex:outputLabel value="Result"/>
              <apex:inputText value="{!result}"/>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

CLASS:
public class firstcls {
public string firstNumber {get;set;}
    public string secondNumber {get;set;}
    public string temp;
    public string result {get;set;}
    
    public firstcls ()
    {
        //firstNumber = '0';
        //secondNumber = '0';
        result = '0';
    }
   public void Addnumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) + Integer.valueof(secondNumber));
    }
    
    public void SubtractNumbers()
    {
        result = string.valueof(Integer.valueof(firstNumber) - Integer.valueof(secondNumber));
    }
    public void Multiplynumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) * Integer.valueof(secondNumber));
    }
    public void Dividenumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) / Integer.valueof(secondNumber));
    }
    public PageReference getBack()
    {
    PageReference ref= new PageReference('/'+00B61000002AkLf);
    ref.setredirect(true);
    return ref;
    }
}

When I am trying to save the above class, I am getting this error-
Error: firstcls Compile Error: expecting a right parentheses, found 'B61000002AkLf' at line 39 column 47

I need guidance on this. Look forward for your helpful replies.

Thanks.
 

 
  • October 30, 2015
  • Like
  • 0
Hi All,
I am new to Salesforce. Just started learning. I have few basic questions as below. It would be great to learn things from you.

1) How to write a validation rule on Opportunity object to make sure that Description is not empty. If the description is empty it should throw an error.
2) Created one formula field called "Auto Complete" of type checkbox. How to make this field to true  when the opportunity stage = 'Closed Won'.
3) Created one custom field called "Is Closed" of type checkbox. How to create a workflow rule to make this field to true when the opportunity stage = 'Closed Won'.
4) There are two custom fields - "DOB" and "Age", how to populate the "Age" value automatically when the DOB is selected?

Thank you!
  • October 10, 2015
  • Like
  • 0

Hi All,
I am new to Salesforce. Just started learning. I have few basic questions as below. It would be great to learn things from you.

1) How to write a validation rule on Opportunity object to make sure that Description is not empty. If the description is empty it should throw an error.
2) Created one formula field called "Auto Complete" of type checkbox. How to make this field to true  when the opportunity stage = 'Closed Won'.
3) Created one custom field called "Is Closed" of type checkbox. How to create a workflow rule to make this field to true when the opportunity stage = 'Closed Won'.
4) There are two custom fields - "DOB" and "Age", how to populate the "Age" value automatically when the DOB is selected?

Thank you!

  • October 10, 2015
  • Like
  • 0
Hi All,
I am looking for Salesforce Developer Job Support based in USA time zone and preferably from the USA. Need help with apex coding, triggers, workflows etc. Please reply back here or email me at mia.p827@gmail.com with the subject line: SFDC Job Support. 
Thanks.
  • September 19, 2015
  • Like
  • 0
Hi Everyone,
I am looking for Salesforce Developer Job Support based in USA time zone and preferably from the USA. Need help with apex coding, triggers, workflows etc. Please reply back here or email me at mia.p827@gmail.com with the subject line: SFDC Job Support
Thanks.
  • September 19, 2015
  • Like
  • 0
Hi All,
I am trying to create my first VF page and Controller class. I need help for further enhancements please.

User-added image

I need help with the following:
  1. When I hit that "Back" command button - it should redirect to a custom object page, lets say - "Employee__c".
  2. Also, a custom page message should come up if any of the numbers/ text not filled (please see screenshot).
  • where and how to add the following:
     if(firstNumber == '' || firstNumber == null || secondNumber == '' || secondNumber == '')
          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter First and Second numbers'));
Please look into the below code for VF Page and Class and help me with the code. Thanks.

VF Page:
<apex:page controller="firstcls">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockButtons location="top">
              <apex:commandButton value="Add" action="{!Addnumbers}"/>
              <apex:commandButton value="Subtract" action="{!SubtractNumbers}"/>
              <apex:commandButton value="Multiply" action="{!Multiplynumbers}"/>
              <apex:commandButton value="Divide" action="{!Dividenumbers}"/>
              <apex:commandButton value="Back" action="{!getBack}"/> //Not sure if, its right or wrong?
             
          </apex:pageBlockButtons>
          <apex:pageBlockSection >
              <apex:outputLabel value="Enter First Number"/>
              <apex:inputtext value="{!firstNumber}"/>
              <apex:outputLabel value="Enter Second Number"/>
              <apex:inputtext value="{!secondNumber}"/>
              
              <apex:outputLabel value="Result"/>
              <apex:inputText value="{!result}"/>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

CLASS:
public class firstcls {
public string firstNumber {get;set;}
    public string secondNumber {get;set;}
    public string temp;
    public string result {get;set;}
    
    public firstcls ()
    {
        //firstNumber = '0';
        //secondNumber = '0';
        result = '0';
    }
   public void Addnumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) + Integer.valueof(secondNumber));
    }
    
    public void SubtractNumbers()
    {
        result = string.valueof(Integer.valueof(firstNumber) - Integer.valueof(secondNumber));
    }
    public void Multiplynumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) * Integer.valueof(secondNumber));
    }
    public void Dividenumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) / Integer.valueof(secondNumber));
    }
    public PageReference getBack()
    {
    PageReference ref= new PageReference('/'+00B61000002AkLf);
    ref.setredirect(true);
    return ref;
    }
}

When I am trying to save the above class, I am getting this error-
Error: firstcls Compile Error: expecting a right parentheses, found 'B61000002AkLf' at line 39 column 47

I need guidance on this. Look forward for your helpful replies.

Thanks.
 

 
  • October 30, 2015
  • Like
  • 0
Hi All,
I am new to Salesforce. Just started learning. I have few basic questions as below. It would be great to learn things from you.

1) How to write a validation rule on Opportunity object to make sure that Description is not empty. If the description is empty it should throw an error.
2) Created one formula field called "Auto Complete" of type checkbox. How to make this field to true  when the opportunity stage = 'Closed Won'.
3) Created one custom field called "Is Closed" of type checkbox. How to create a workflow rule to make this field to true when the opportunity stage = 'Closed Won'.
4) There are two custom fields - "DOB" and "Age", how to populate the "Age" value automatically when the DOB is selected?

Thank you!
  • October 10, 2015
  • Like
  • 0

Hi All,
I am new to Salesforce. Just started learning. I have few basic questions as below. It would be great to learn things from you.

1) How to write a validation rule on Opportunity object to make sure that Description is not empty. If the description is empty it should throw an error.
2) Created one formula field called "Auto Complete" of type checkbox. How to make this field to true  when the opportunity stage = 'Closed Won'.
3) Created one custom field called "Is Closed" of type checkbox. How to create a workflow rule to make this field to true when the opportunity stage = 'Closed Won'.
4) There are two custom fields - "DOB" and "Age", how to populate the "Age" value automatically when the DOB is selected?

Thank you!

  • October 10, 2015
  • Like
  • 0

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.