Survey is very important to grow your business and get feedback from customer on your product or services time-to-time to improve it. Now if your customer says to create a Survey in Salesforce and they want to show one question on every screen and they also want anyone can access this feedback without login into Salesforce, and as soon as they are done with feedback all data should be saved into some object. Now first thing comes up in your mind is Visualforce page, but no we can handle this type of situation with Visual workflow.
Business Use case :-Universal container management want to create a simple survey with fields (Name, Email,Address, Rating and Comment) form and they want a way to host this form so anyone can access it without login into Salesforce.
Solution of above business use case
First of all we have to create a Survey Object with below mentioned fields so we can save customer’s feedback
Object Name | Data Type | Display Format |
Survey | Number | S-{0000} |
Field Name | Data Type |
Comment | Text Area(255) |
Email Address Send | |
Name | Text(100) |
Rating | Text(45) |
Now we will create a simple survey form, to do this follow the below instructions
- Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
- Click on New Flow, it will open flow canvas for you
- Drag and drop a Screen #1 ( Give the name Ready for survey) on window, add field Drop-down (Name – Ready For Survey) with Value Yes/No as shown in below screen shot
- Now we will add another screen #4 ( Give the name survey)to create survey. Drag and drop a Screenfrom palette Add text-box ( Click on Add a field tab to ad field) to save Name, make it required field and fill the details as shown in below screen shot
- Like wise you can add Email address field on the same screen use Text-box type field only, as below in below screen shot
Now add another field called as Rating data Type (Radio Button) make it required field, select choice value data type as number (Enter 1, 2,3 ,4 and 5 as choice) , same as below screen shot
- Likewise you can add Comment box (Data Type :- Text Area long) make it required field, finally it will look like below screen shot
- Now we will create record on Survey object based on data field on Survey form. To do that drag and drop Record Create Lookup i.e Screen #5 from palette, enter the Name and map field according to your choice in our case you can map survey field with Screen#4 input field as shown in below screen shot
Now we will create Thanks Screen #3 , to do that drag and drop screen into canvas, navigate to Add a field tab move to Output section and use output text and enter some message as shown in below screen shot
- Now add decision in to your canvas, to make sure if user don’t want to participate in the survey redirect them to thanks screen. For this you have to add two outcome (One for Yes and one for No) as shown in below screen shot
Finally Our flow will look like below screen shot, you can also add thanks message after completion of Survey as I did
Note:- Make sure you set Screen 1 as start point and activate your flow.
You can use this flow within Salesforce very easily. To do that create some custom button and call this flow, If you don’t know how to call flow from custom button you can take help from my old blog (Auto select automatically follow records that I create checkbox). If you want to fire survey on Opportunity closer as your organization want to save Sales rep feedback that will help in future deal, you can also do that by using apex code.
Create a Visaulforce page
As You can’t grant flow access to unauthenticated user, so we will use Visualforce page and then host it to site. Wait wait I will use only 2 tags in page. Create on Visualforce page with Name Flow and paste below code and replace word survey with your flow name (I saved my flow with name Survey)
<apex:page >
<flow:interview name=”Survey”/>
</apex:page>
<flow:interview name=”Survey”/>
</apex:page>
Host Survey on Force.com site
Now next target is host this form on force.com site so anyone can use this survey form. this is pretty easy work. DO to this follow the path
- Name | Setup | App Setup | Develop | Sites
- If sites is not enabled for your organization, it will look like below screen shot register one for your organization
- Now add Visualforce page under Default Web Address, Active Site Home Page as shown in below screen shot
- Under site public access settings make sure guest user have create access on Survey object andedit on fields that we are using to create record in our flow.
- To do that Click on public access settings | Object Settings | Survey object and grant create access on object and edit on fields
Create workflow to send thank you message
Final target is ti send thank you message to each participant, for this we will use, workflow. To create a workflow rule follow the path
- Name | Setup | App Setup | Create | Workflow & Approvals | Workflow Rules
- Click on New Rule button
- Enter entry criteria field Email address send not equals to null
- Add Intimidate action Email alert, you can add your email template and from Recipient Type drop down select Email field and select Email address send field as shown in below screen shot
It’s time to test this feature
- Run your flow, In the very first screen it will ask you,if you are ready ? select yes and click next on Survey Screen1as shown in below screen shot
- In the second screen fill the form correctly, mainly use email address proper format (Abc@tets.com), If email address is correct you will get thanks you email and click on next. You can take help from below screen shot
- In the last screen it will show thank you message, click on finish button then only survey will complete, as shown in below screen shot
Post a Comment