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
Agent Comms 7Agent Comms 7 

Visualforce pages

I have created a custom web to case form. on click of submit button a case record is created in the org and user is redirected to a thanks page. I want to display the case number of the created case on that thanks page. Both the pages have different controllers. Can anyone tell what to do for that?
srlawr uksrlawr uk
When you say you have created a web-to-case form, you mean you have generated the HTML and put it on an external website? Otherwise, I'm not sure what you have done to create that page and a "thank you" page that "have different controllers" - the web-to-case page and thank-you page should both be sat on some completely different servers out in the wild internet?

The short answer is "no" sadly - there is no way to get the Case ID back in a web-to-case submission, it is a fire and forget form submission from your web-to-case to the salesforce servers, which makes a case. 

What you can do is include the Case ID in the email-template you provide as a "thanks for contacting support" email? So on your thank you page, could you invite the user to check their e-mails for the case ID?


If you have done something weird like including the web-to-case form on a visualforce page, and the thank you page on visualforce (using sites.com maybe?) then there probably is a solution, but there is probably also some other problems :D 
 
Agent Comms 7Agent Comms 7
Yes I have created a visualforce page for web to case form and another for thenks page.
srlawr uksrlawr uk
how are you exposing the web-to-case page to the world then? on a Salesforce sites?

If you are using visualforce, you know you can just use the case standardcontroller/apex:form to create a case and then just do a normal save/rerender to display thanks and the case ID to a user?

if you have a VF page with the web-to-case HTML on, I think you have buried yourself in a pickle regarding returning the case ID for the thank you page, because the form on the page will fire the case information all the way OUT of your salesforce Org to the standard Salesforce web-to-case endpoint, where it will then be filtered back in to your org?! See why it's weird... I would just write a standard Visualforce page for case creation - unless there is a specific reason you are using web-to-case.