function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ben Be 4Ben Be 4 

Is there a way create an opportunity when existing customer wants to order a service from a website.

Hi There, Does anybody knows if there is a way to create an opportunity directly when a customer order a service from our company website. Can you do process builder or need a Apex trigger ? Feel free to  direct me to a link with the process builder or trigger solution.
Best Answer chosen by Ben Be 4
Lokesh KumarLokesh Kumar
HI Ben,

Create a visual force page with standard controller as "opportunity" and include whatever inputfields from the object which you want to give as input on the form. Use standard Save action which will automatically create the record for you.

In case you have site already published in your salesforce org, include this visualforce page as well in the site. 

Posting sample code below: 
<apex:page standardController="obj">
    <apex:form >
        <apex:pageBlock >
             <apex:pageBlockSection >
     <apex:inputField value="{!obj.field1}"/>
     <apex:inputField value="{!obj.field2}"/>
     .............
     <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>        
</apex:page>

You can modify the above code according to your requirement.

let me know if this helps you !

Thanks, 
Lokesh

All Answers

LBKLBK
You can expose a VF page using Sites in Salesforce.

You can show this VF page in your web site, which will not require any authentication to see.

Your customer can order a service from this VF page, which can very well create an Opportunity directly.
Lokesh KumarLokesh Kumar
HI Ben,

Create a visual force page with standard controller as "opportunity" and include whatever inputfields from the object which you want to give as input on the form. Use standard Save action which will automatically create the record for you.

In case you have site already published in your salesforce org, include this visualforce page as well in the site. 

Posting sample code below: 
<apex:page standardController="obj">
    <apex:form >
        <apex:pageBlock >
             <apex:pageBlockSection >
     <apex:inputField value="{!obj.field1}"/>
     <apex:inputField value="{!obj.field2}"/>
     .............
     <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>        
</apex:page>

You can modify the above code according to your requirement.

let me know if this helps you !

Thanks, 
Lokesh
This was selected as the best answer