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
vihiovihio 

How do you get public data submissions??

I put together a little estimate form so people can submit their projects to this company and get a reply with pricing and time and things like that.

 

Well I found out quite quickly that you need to write a custom controller/extension to allow public users get their data submitted into force.com. well I can't for the life of me get this to work with my extension. keep in mind I'm a teen and this is my first time developing with apex so don't start flaming me because of my so so code haha

 

my extension:

 

public class EstimateExtension
{
    public String getEstimate() {
        return null;
    }
    public PageReference save() {
        return null;
    }
   public Estimate__c estimate {get; private set;}

    public EstimateExtension
(ApexPages.StandardController stdController) {
estimate = (Estimate__c)stdController.getRecord();
}
    public EstimateExtension () 
    {
         Id id = ApexPages.currentPage().getParameters().get('id');
         estimate = (id == null) ? new Estimate__c() : [SELECT First_Name__c, Last_Name__c, Title__c, 
         Your_Company__c, URL__c, Your_Email__c, Primary_Number__c, Your_Budget__c, 
         What_Services_Are_You_Interested_In__c, If_Others__c, Tell_Us_About_Your_App__c, About_Us__c, Message__c  
         FROM Estimate__c WHERE id = :id];
    }
    
    public PageReference saveApplication() {
       try {
           upsert(estimate);
       } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        estimate = new Estimate__c();

        return (new ApexPages.StandardController(estimate)).view();
    }
    
    
}

 

EDIT: If it helps or matters, I am a free user. I do not pay for the live site

CoryCowgillCoryCowgill

Its not clear form your post what exact issue you are having.

 

However, it sounds like you want to use Force.com Sites. I have done similar functionality with anonymous form submissions where you want public users to submit forms and create corresponding objects in the Salesforce org for surveys and stuff like that.

 

I would recommend you take a look at the introduction to Force.com Sites. Take a close look at the security section as this tends to be where people get caught up in my experience, setting permission on the VF Pages, Objects, Etc.

 

http://wiki.developerforce.com/index.php/An_Introduction_to_Force.com_Sites

vihiovihio
Thanks for the reply. I finally fixed it yesterday though. Turned out i had a weong pagereference. I changed my extension to a controller, changed the saveAccount pagereference to submitEstimate and changed the action in my visualforce page to submit. I knew it was going to be a stupid mistake.