0

I would like some users of my company to be able to fill out forms which information goes directly to SFDC. I thought about something like Customer Portal but it's expensive for what they actually need.

Would it be possible to have a place (site,.URL,visualforce page,....web-to-form??) where users can enter some data in a particular form without buying a license for each of them? They access to Salesforce information should be restricted to strictly the form they want to fill out.

Thank you!!

1
  • 1
    Have you checked web-to-lead in Salesforce? Commented Aug 7, 2013 at 22:45

3 Answers 3

1

Yes you could create those forms in VF and expose the VF as public pages in a force.com site. Every force.com site has an anonymous user associated with it who's profile you can modify to allow for the data input.

You can find more information about force.com sites here: http://wiki.developerforce.com/page/Sites

2
  • Thanks Tim! I understand force.com site comes with a cost. Is there any other option where I don't have to pay per user?
    – Chicho
    Commented Aug 7, 2013 at 16:34
  • What version of Salesforce do you have? If EE and above, force.com sites is included. You may be confusing force.com sites with Site.com.
    – Tim Smith
    Commented Aug 7, 2013 at 16:48
1

One way to achieve this is to create a SOAP or REST webservice and have your form hosted outside the sfdc like may be on wordpress site or PHP .Once you fill the form and SOAP or REST webservice will be called .

You can create public webservice for the same .Search on this site you will find manylinks on how to create public webservice .

Please follow the below link for public webservice

Error Accessing Public SOAP Web Service in Salesforce

Another thought is configure wordpress form and on filling it will send an email with body of form to sfdc email services configured .Write an APEX code to parse the body of mail and do DML in sfdc.

In all the above approach a sfdc admin licence will be sufficient .

1

If you don’t want to invest in Sites or Communities, then an email service seems like the best option. You can just have your website send a formatted email to an email service you create in SF. You first need to write an Apex class to handle the inbound email. I have used the following email format and Apex Class which is a modified version of an Email service you write in DEV501.

I use the following format for the email from your website

[STARTBODY]firstname=John:lastname=Doe:phone=5555555555:field=value[ENDBODY]

Write an apex class that implements Messaging.InboundEmailHandler Here’s a basic example of the email handler that you can likely modify

global class MyEmailHandler implements Messaging.InboundEmailHandler {

    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
        Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();

        try{       
            String theBody;       
            List<String> fieldList = new List<String>();
            if (email.plainTextBody != null){
                theBody = email.plainTextBody;

            } else {
                theBody = email.htmlBody;
            }
            theBody = theBody.substring(theBody.indexOf('[STARTBODY]')+11,theBody.indexOf('[ENDBODY]'));
            fieldList = theBody.split(':',0);  

            Map<String,String> fieldMap = new Map<String,String>();
            for(String field : fieldList){
                if (field.split('=',0).size() == 2){
                    fieldMap.put(field.split('=',0)[0],field.split('=',0)[1]);  
                }
            }

            Contact con;
            try{
                con = [select id,FirstName, LastName From Contact where LastName =:fieldMap.get('lastname')];
            } catch (QueryException qe){
                if (con == null){
                    con = new Contact();
                }
            }
            // update or insert the field values that came in the email
            con.FirstName = fieldMap.containsKey('firstname') ? EncodingUtil.urlDecode(fieldMap.get('firstname'),'UTF-8') : null;
            con.LastName = fieldMap.containsKey('lastname') ? EncodingUtil.urlDecode(fieldMap.get('lastname'),'UTF-8') : null;
            //Any other fields you use in your email from the site


            try{
                if (con.id == null) {
                    insert con;   
                } else {
                    update con;
                }
            } catch (DMLException e){
                result.success = false;
                return result;
            }


        } catch (Exception e){            
            result.success = false;         
            return result;
        }

        return result;
    }
}

Then you just need to create a new email service that uses this new Apex class. You can do that by going to Setup -> Develop -> Email Services -> New

Hope this helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .