You need to sign in to do that
Don't have an account?
alexander yurpolsky
Salesforce: Creating a User Form using VisualFocre
I have below requirement to Create a VF page. I created a custom object called DormsApplicants__c There are several fields but for the purposes of the example we will use only one field called First_name__c.
My main need is to create a VF page that will be available to people outside the organization (i.e. customers) who can enter data into the form and then create a record in the custom object DormsApplicants__c. For this purpose I created a website (SITE.COM) and then created a VF page (called TEST) I defined this page (TEST) as a home page on the site.
This is my page:
This is what users see outside the organization.
When the user tries to click "save" he gets the following error
Of course no record is created. I'd love to hear what the problem is?
My main need is to create a VF page that will be available to people outside the organization (i.e. customers) who can enter data into the form and then create a record in the custom object DormsApplicants__c. For this purpose I created a website (SITE.COM) and then created a VF page (called TEST) I defined this page (TEST) as a home page on the site.
This is my page:
<apex:page standardController="DormsApplicants__c" sidebar="false"> <apex:form id="theForm"> <apex:pageBlock title="TEST"> <apex:inputText title="TEXTBOX1" label="TEXTBOX2" value="{!DormsApplicants__c.First_name__c}"/> <apex:commandButton value="save" action="{!save}"/> </apex:pageBlock> </apex:form>
This is what users see outside the organization.
When the user tries to click "save" he gets the following error
Of course no record is created. I'd love to hear what the problem is?
To enable Visualforce pages for your site:
From Setup, enter Sites in the Quick Find box, then select Sites.
Click the name of the site you want to modify.
Click Edit on the Site Visualforce Pages related list.
Use the Add and Remove buttons to enable or disable Visualforce pages for your site.
Click Save.
Grant Visualforce page access to the Customer Portal or site user's profile.
As you are able to view the page and save button it means all required site permissions are already there.
Record was not created means any exception was occurrd. It may be due to validation rule or process builder failure.
You need to troubleshoot it after disabling any process builder on this object.
If record created;
(If record will save then you will get another issue on site, because after record insertion by standard save action, page will redirect to related record id on site, In this case I suggest to use custom save action for site base functionality)
As for Raj V suggestions of - I did all the steps and it did not solve the problem.
Just to be clear regarding the problem. The record is not created. So @Om Prakash how can i to "troubleshoot". I have no processes/wf on the object. A simple object with only one required field.
Thanks for the help.
Add to my site https://ibb.co/i5Ey5H
Then I opened the site (the new specific page I created while I'm not logon to salesforce) https://ibb.co/ciJEec I could see the page even when I was not logged in. I entered a value into a text box and click "Save"
Then I get a permission error https://ibb.co/i9MBQH
The recored is not created. What's the problem now?
Please check the url in browser when you get authentication error after save button click.
There should be be a record id after your site url in browser and record was created.
Now, if you mean That this the ID of the record - a000Y00000mEw30
I can not find it in the system. And its a appear that the record did not created successfully.
Can you open that record directly by pasting record id in browser's after standard salesforce instance url. (Not on site)
You might be not able to see that record in list view if list view was configured only to show current login user's record in salesforce .
Here created record's owner was Guest user.
But now, how do I present my user with a normal message? For example "Your form has been successfully submitted" or something like that. Instead of the authorizationmessage?
Also I have replaced save action with quicksave, so that page will not redirect and your use case can achieve.