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
Peter Russell 9Peter Russell 9 

Setting up a Web to Opportunity form

Hi,

I would like to create a custom web form that will have fields related to opportunity fields. The idea is, when an employee completes the form, the data that is submitted will be populated in pre-existing fields in a pre-existing opportunity. 

Does anyone know the best way to go about this? We are on Enterprise edition, my coding knowledge is extremely limited FYI!

Thanks,
Pete 
Jayant DasJayant Das
This will certainly require some apex development.

Will you be submitting the values everytime from the form to the same opportunity or there can be different opportunities that may be updated, and do you need to process further custom logic while saving it on the record? Such integrations can be implemented by exposing a custom REST service to capture the values as submitted on the web form and update the opportunity that needs to be with all custom logic that needs to be incorporated. It will be the web platform's responsibility to invoke the API exposed by Salesforce. You can find more on building custom REST services on the documentation here (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest.htm).

If the opportunity is always known, then there won't be a need of any custom REST service, instead the web platform can make a callout to standard REST services provided by Salesforce and just update the opportunity fields. More on this can be found here (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm).
Peter Russell 9Peter Russell 9
Hi Jayant,

Thanks for your reply.

I forgot to mention, one of the fields in the webform will contain a reference that will relate to that particular opportunity. So the form or salesforce will need to identify an opportunity by a reference contained within a field. 

How feasible do you think this would be? Just to give you some context, we are a law firm, after a consultation with a client has taken place, we require the lawyer to complete this web form which will then update details on the clients salesforce opportunity, identifying the opportunity record by the clients case number which is contained within the opportunity. 

Thanks,
Peter
Jayant DasJayant Das
Hi Peter,

This can be achieved by utilizing REST services (no custom services need to be written in Salesforce). If the reference of the field in the form is the "opportunity id" of the record in Salesforce, that's even straight forward by just updating the record based on the id. If not, then the reference field value as in form can be stored as an "external id" on the opportunity record, so that based on the external id, updates can be made.

In any case, it will be the responsibility of the web platform to invoke the API calls. What needs to be done in Salesforce is to set up a connected app and share the client secret/key so that the consumers (web platform) utilize those and invoke the REST APIs.

Some reference links:
Hope this helps.

Thanks,
Jayant
Peter Russell 9Peter Russell 9
Hi Jayant,

Thank you so much for your response. I will have a read of them links this evening, I may come back with more questions tomorrow if that is okay! I am enjoying learning the development of Salesforce.

Thanks,
Pete
Jayant DasJayant Das
Sure Pete, as much as I can be of help.
Peter Russell 9Peter Russell 9
Hi Jayant,

The requirements may have gotten a little more complicated.

I basically need to find a way for the web form to field merge a pre-made word document/PDF with some of the info from the form and then email it to the email address stored in the opportunity/contact, as well as putting the info in the opportunity. 

Would this be possible at all?

Thanks,
Pete
Jayant DasJayant Das
Hi Pete,

Didn't follow this part -- [find a way for the web form to field merge a pre-made word document/PDF with some of the info from the form] but as long as the required information is present on the opportunity, you can always send emails from salesforce. You can utilize email templates to configure the email body and other details as required. More on email templates can be found here -- https://help.salesforce.com/articleView?id=email_templates_landing_page.htm&type=5

Thanks,
Jayant
Peter Russell 9Peter Russell 9
Hi Jayant,

We are already in the process of setting up conga (to merge PDF's and attach them to an email template). Ideally I'd like the below process to be achievable: 
  1. Lawyer completes webform
  2. Submitted data is input into opportunity fields
  3. The completing of certain fields triggers conga to automatically merge fields into word/pdf document
  4. The email is then automatically sent to the client with attached word/pdf document
Sorry if this is confusing, do you think this is possible? I have a small amount of experience in using process builder so on the surface it looks like it could well be possible?

Thanks,
Pete 
Jayant DasJayant Das
Hi Pete - the short answer is Yes, this is possible. You will need to utilize different techniques/implementation approaches to achieve this though. E.g., #1/2 - It will be an integration from the web to salesforce. #3/4 - Will be a trigger/process builder/workflow rules implementation and #5 - Workflow Rules/Emails.
Peter Russell 9Peter Russell 9
Hi Jayant,

Thank you for your help.

I am going to give this a go, the only thing I'm a bit unsure about would be triggering SF to start the merge using an external app, do you know how this would work?

Thanks,
Pete 
Jayant DasJayant Das
I do not have visibility on Conga objects, but I would believe it allows a mechanism either through a workflow update or trigger or process builder to initiate their process. Just to give you some background, we do have such scenarios in day to day implementations, and it has worked quite well. So I would think, it won't be a problem here.

Wish you the best!