I am looking for a solution to dynamic questionnaire solution where the next question depends on the response of the previous and i need to store the response as well for each question and based on certain response i need to create a task.

What would be the best way to implement this.

For example see the structure below:

Q1. Here is the question. A. Option 1 B. Option 2 C. Option 3 D. Option 4 If A is selected then i will have two more questions:

  1. What is the date?
  2. A question whose ans will be boolean Based on above response a task will be created. If B is selected then again i will have two more questions. . . . . So on.

So this is my senario. I have tried Survey object but with that we cannot perform any action after the response is stored and we cannot provide any desired UI.

Any help will be appriciated. Thanks in advance!

  • Who will be completing the survey, your salesforce users or the general public?
    – edralph
    Mar 6 '21 at 18:58
  • saleforce users only.. Mar 7 '21 at 5:44

If it is for internal users you could use a Screen Flow. There is plenty of stuff out there about them for example this.

In each screen select the question and store the answer afterwards as a record in a custom object. Then the next question can be selected based on the previous answer using a decision element.

If it were a one-off survey you could hardcode the question retrieval and decision logic into the flow. If you wanted to re-use the flow without having to rewrite it every time you would improve the datamodel a bit by adding a Survey identifier (so that questions and answers can be linked to a specific survey) and you would have to include the 'next question Id' in the 'possible answers' records (if it was a fixed choice answer like multiple choice or checkbox). Freeform answers and automatic decision branching is a bit more tricky.


The requirements can be catered via Salesforce Survey.

  • Showing on the desired UI
    • there is a component which
    • you can have LWC component and use Survey in iFrame
  • Creation of Task on Response
    • you can write a trigger on SurveyInvitation Object. If it's responseStatus is completed, then you can proceed for your task creation.
  • Conditional Questions/Pages - Can be done through the Survey itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.