Create-An-Opportunity-Using-A-Visualforce-Page-In-Salesforce

How To Create An Opportunity Using A Visualforce Page In Salesforce

By admin January 20, 2014
Blog, Salesforce Development 1

Another question has been asked to our expert Salesforce developers which we thought would be useful to share on our blog. The question was how you can create an opportunity using a Visualforce page within the Salesforce CRM. If you follow these step by step instructions provided by our expert Salesforce development team, you can do it yourself in no time.

Step 1 –

In Salesforce, go to Setup → Build → Develop → Apex Classes

Click on the “New Button” to create an Apex Class

Step-1

Step 2 –  Paste this code in your Salesforce Apex Class editor

public class OpportunityInformationPage {public opportunity oppstring{get; set;}public OpportunityInformationPage(){oppstring= new opportunity();}public void Saveto(){opportunity opp= new opportunity();opp.Accountid= oppstring.Accountid;opp.name= oppstring.name;

opp.closedate= oppstring.closedate;

opp.StageName= oppstring.StageName;

opp.leadSource= oppstring.LeadSource;

opp.Ownerid= oppstring.Ownerid;

opp.Amount= oppstring.Amount;

opp.IsPrivate= oppstring.IsPrivate;

opp.NextStep= oppstring.NextStep;

opp.Type= oppstring.Type;

opp.Probability= oppstring.Probability;

opp.Campaignid= oppstring.Campaignid;

opp.OrderNumber__c= oppstring.OrderNumber__c;

opp.MainCompetitors__c= oppstring.MainCompetitors__c;

opp.CurrentGenerators__c= oppstring.CurrentGenerators__c;

opp.DeliveryInstallationStatus__c= oppstring.DeliveryInstallationStatus__c;

opp.TrackingNumber__c= oppstring.TrackingNumber__c;

insert opp;

}

}

Step 3 –

In Salesforce, Go to Setup → Build → Develop → Pages

Click on the “New Button” to create a new page

Step 3

Step 4 – Create a Visualforce page with the name Opportunity Information Page, in the field type Opportunity Information Page, In the name field type Opportunity Information Page

Step 4

Step 5 –  Paste this code in the Visualforce editor in Salesforce

–>

Step 6 – Open this Visualforce page in your browser which should display like the following screenshot

Step 6

Step 7 – Enjoy

We hope these step by step directions on how to create an opportunity using a Visualfroce page within Salesforce have been helpful. As always any Salesforce development questions or problems you have, please feel free to reach out to the team at Mind Digital as our Salesforce developers would be more than happy to help!

Related Posts

Popular post