salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.42k stars 2.07k forks source link

Survey Responses create a new Case and email the Contact #8847

Open babington-andy opened 4 years ago

babington-andy commented 4 years ago

Issue

When a Contact completes a Survey a 'happiness' score is calculated, if this is considered negative it creates a new Case, there is no reasonable way to prevent this from happening, there are numerous scenarios where this behaviour would be unexpected/undesired. The way a happiness score is calculated is also pretty rigid and will only work in specific scenarios.

Additionally, an email is sent to the Contact after they have completed the Survey, this is preventable by simply not having the relevant Email Template or not defining $sugar_config['survey_positive_confirmation_email']; or $sugar_config['survey_negative_confirmation_email']; .

Both of these behaviours should really be something that can be enabled/disabled.

Expected Behavior

As Site Admins we should be able to turn off the behaviours described above, or at least be able to override them in an upgrade safe way.

Actual Behavior

The behaviours described above are not configurable, and thers is no reliable upgrade safe way to override these behaviours.

Possible Fix

Add a config option either in site admin or as a config.php setting to enable/disable these behaviours. In the SurveyResponses.php file in the save() method check the setting before creating a case and sending an email.

Steps to Reproduce

  1. Create a Survey with at least one question, make it Public
  2. Create a test Contact and make a note of it's ID
  3. Go to the Survey entry point and append to the url &contact={contact_id}
  4. Complete and Submit the Survey
  5. A Case should be created and assigned to the Contact assigned user

Context

I sent some surveys out to Contacts, when they completed the surveys a case was created and assigned to their assignee even though the responses were not negative. This caused a lot of confusion. Thankfully I didn't have the email templates necessary to email the Contacts so these were not sent.

Your Environment

kale1d0code commented 2 years ago

I would like to point out that happiness in surveys does not work anyway. there is no way to specify if a question is regarding happiness (unless you set it directly in the database table but it does not look as if this value is taken into account regardless),

you will find that every response made would have a happiness of -1 because that's the default value set for the SurveyResponse in the SubmitSurvey file

kale1d0code commented 2 years ago

I am looking into writing up a corrected SubmitSurvey file and I'm thinking of just supporting the rating type but I will get back to you after I find out more about the original functionality and answer some questions (rating only has 5 stars so should each star be equal to 2 happiness?)

looking at the SurveyResponse bean -1 happiness is regarded as a positive response so I will see if I can remove this value without breaking anything when happiness isn't even regarded in the Survey

AlbertoSTIC commented 2 years ago

Thanks @kale1d0code . We would love to receive some updates here.