SalesforceLabs / survey-force

85 stars 61 forks source link

Issue on saving a survey feedback "Some error occured while saving response" #32

Closed leocatan closed 4 years ago

leocatan commented 7 years ago

Hi,

on submitting survey feedbacks I have the error message "Some error occurred while saving response". It seems is occurring only when the case is linked to an account.

Could you please verify it ?

Regards Nicola

jrattanpal commented 7 years ago

Can you test this again? But before you run the code, do the following

If your test uses force.com site then you will need to set a debug cookie for guest user for debug logs to work.

https://releasenotes.docs.salesforce.com/en-us/winter17/release-notes/rn_forcecom_debugging_guest_user.htm

leocatan commented 7 years ago

Hi,

in attachment the logs requested.

Regards Nicola

leocatan commented 7 years ago

Hi,

in attachment the logs requested.

Regards Nicola

apex-07Lm000000Q4BoEEAV.log - Notepad.pdf

giuseppedellerba commented 7 years ago

Hello @jrattanpal ,

could you please feedback, for us that issue is a blocking point to deploy Survey Force.

Thanks

jrattanpal commented 7 years ago

Hi,

As per the log, error message is

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: 500m00000077sv8:

This error means there is permission issue for either case object (500) or some Lookup field on case object.

These errors are very hard to debug as there are no tools for this. You will need to see which user is creating the record and if they have access to Case and all Lookup fields (related records) on case object.

To confirm, it is a CRUD/FLS issue but not related to Survey Force. From the log, it seems error is in https://github.com/ForceDotComLabs/survey-force/blob/master/src/classes/ViewSurveyController.cls in AddSurveyTaker() at line#387

Which every user you are trying to use to get there, doesn't have permission to Case object it seems.

Let me know if that helps.

giuseppedellerba commented 7 years ago

For our Service Cloud deployment, that Survey Force tool is critical and that issue is a blocking point.

I will summarize setup in our environment :

Thank you for submitting your question to us online. Case #{!Case.CaseNumber}: "{!Case.Subject}" has been Closed .

Please rate your overall satisfaction with Support for this specific Case: https://stqa-st.cs20.force.com/survey/TakeSurvey?id=a14m0000001ZlRZAA0&cId={!Contact.Id}&caId={!Case.Id}

Thank you, ST Support Team

Could you help in fixing that issue?

By the way, in the Survey URL, have you foresee the option to add the Account.ID together with Contact.ID and Case.Id?

Thanks in advance for your help.

loredanasimion commented 6 years ago

Hi, I'm having the same issue... Customers who have to fill in the Survey get "Some error ocurred while saving response". How can I see why this is poping out?

Thanks so much!

jrattanpal commented 6 years ago

@loredanasimion

You should collect Apex debug logs to see what is going on . That shold tell you where it might be failing. I am guessing it's a permission issue either on object or one of the fields.

loredanasimion commented 6 years ago

Thanks for your reply. Could you please tell me the step by step how to do this? Thanks so much for your help

jrattanpal commented 6 years ago

@loredanasimion

It's heavy topic and hard to explain here. But I have included some links that might be helpful to you.

https://www.youtube.com/watch?v=Ns61TOtbIDg

https://www.youtube.com/watch?v=dkoDzOtgQSc

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging.htm

claico commented 6 years ago

I have worked a lot with the original Surveyforce over the years. One approach is to not pass anything in the url except the random id, which links to a survey invitation. The survey invitation should link to the contact, which links to an account. So there is no need to pass a contact id or an account id. And the case id can also be referenced on the invitation record.

joshualong2012 commented 4 years ago

I had the same error pop but looking at debugs it looks like the latest code for running anonymous surveys you are checking: if(caseId.toUpperCase() =='none'|| caseId.length()<5) caseId = null;
if(contactId.toUpperCase() =='none'|| contactId.length()<5) contactId = null;
forcing upper but comparing to lower they will never match. I'm updating the code base in our system to correct this but wanted to make it known here as well.

I think you may also have some issues with the anonymousAnswer logic as well that you may want to look over.

jrattanpal commented 4 years ago

Thanks! I made few changes today and this was one of the issues I fixed. I believe I have also fixed anonymous user error.

Of course I added some crud/fls permissions so if guest user doesn’t have right permissions then it won’t work anymore. I had to go through Security Review so those changes were required.

giuseppedellerba commented 4 years ago

@jrattanpal do we need to reinstall the app from App Exchange?

jrattanpal commented 4 years ago

@giuseppedellerba

If you want to then sure. But as it's managed package, you will need to uninstall existing app but you will loose all customizations.

Easiest is to take the GitHub code, move it to sandbox, test it there and then move to production.

I have moved all new changes to GitHub

giuseppedellerba commented 4 years ago

Thank you @jrattanpal ! Will we be able to check in the GitHub code the updated classes? So, as you correctly suggested, we will not loose our (few) customizations?

jrattanpal commented 4 years ago

You can check github "commits" history to see the changes made.

if you have changed some classes then you have to be careful as just moving this code to sandbox may overwrite your code. You have to figure out how to merge the code from GitHub and your custom changes.

FabLavielle commented 4 years ago

Hi, on submitting survey feedbacks I have the error message "Some error occurred while saving response". It occurs whenever it's related to a contact. I have checked the sharing settings and everything looks correct. We have a community as well and it looks like it might be causing this issue:

Screen Shot 2019-12-08 at 5 19 54 PM Screen Shot 2019-12-08 at 5 20 02 PM

Can you help me with that? It's urgent, the client is blocked.

Thanks in advance for your help.

Fabienne

jrattanpal commented 4 years ago

Hi,

Have you collected debug logs? Logs should tell you what the error is and you can use that to figure out the issue. You can post debug log here and I can also take a look

I am not sure about the screenshot code. That is used to general site url but has no impact on how surveys are submitted.

FabLavielle commented 4 years ago

Hi,

it just shows success status which is even more confusing:

[image: Screen Shot 2019-12-09 at 11.20.45 AM.png]

--

Fabienne Lavielle

Salesforce Consultant | Plative

fabienne@plative.com

On Mon, Dec 9, 2019 at 10:24 AM jrattanpal notifications@github.com wrote:

Hi,

Have you collected debug logs? Logs should tell you what the error is and you can use that to figure out the issue. You can post debug log here and I can also take a look

I am not sure about the screenshot code. That is used to general site url but has no impact on how surveys are submitted.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SalesforceLabs/survey-force/issues/32?email_source=notifications&email_token=ALSYULL43M4PG5PXGIG25TDQX2EPPA5CNFSM4DSV3PL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGKE36Q#issuecomment-563367418, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSYULOCIO4QP6AXDUJY34TQX2EPPANCNFSM4DSV3PLQ .

jrattanpal commented 4 years ago

I can't see the image. You need to open the debug log and look into it. There will be multiple files so you need to check which one will show the error. And it shows success because it captures all Exceptions and handles those gracefully; We just don't want to show sensitive information to guest users so we show generic message.

FabLavielle commented 4 years ago

It says " DEBUG|Exception: Invalid id: {!}

19:12:01.0 (33934372)|VF_PAGE_MESSAGE|Some error occured while saving response 19:12:01.0 (33952386)|SYSTEM_MODE_EXIT|false

But the contact exist in SF

--

Fabienne Lavielle

Salesforce Consultant | Plative

fabienne@plative.com

On Mon, Dec 9, 2019 at 11:27 AM jrattanpal notifications@github.com wrote:

I can't see the image. You need to open the debug log and look into it. There will be multiple files so you need to check which one will show the error. And it shows success because it captures all Exceptions and handles those gracefully; We just don't want to show sensitive information to guest users so we show generic message.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SalesforceLabs/survey-force/issues/32?email_source=notifications&email_token=ALSYULIUBTR3P6Y5ZOSVSDTQX2L2FA5CNFSM4DSV3PL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGKLRIQ#issuecomment-563394722, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSYULKDRL26AC62XKYRW4LQX2L2FANCNFSM4DSV3PLQ .

jrattanpal commented 4 years ago

There must be other debug logs; one request creates multiple logs. You need to make sure you are logging the errors (in debug filters) and that you open all those logs and see where the error is.

It will tell you where it happens in Apex code and the line. In most cases, it should also tell you what was the exception before that generic message is displayed.

FabLavielle commented 4 years ago

Hi,

I went through all the logs and just this one shows an error. The exception is Invalid id

--

Fabienne Lavielle

Salesforce Consultant | Plative

fabienne@plative.com

On Mon, Dec 9, 2019 at 1:06 PM jrattanpal notifications@github.com wrote:

There must be other debug logs; one request creates multiple logs. You need to make sure you are logging the errors (in debug filters) and that you open all those logs and see where the error is.

It will tell you where it happens in Apex code and the line. In most cases, it should also tell you what was the exception before that generic message is displayed.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SalesforceLabs/survey-force/issues/32?email_source=notifications&email_token=ALSYULKTNLANJXVOYA2ES2DQX2XMXA5CNFSM4DSV3PL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGKWKWQ#issuecomment-563438938, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSYULIV7H2JT22X55L5LPDQX2XMXANCNFSM4DSV3PLQ .

jrattanpal commented 4 years ago

Sorry, I can't say without looking. Only thing I can think of is that Contact ID is not valid. But I can't say without looking or being able to investigate.

LaureanoF commented 4 years ago

Hi,

I've been through the same issue, and after trying with object acess (creating sharing rules for Contact, Cases, Account) finally I found that it's a field level security permissions.

Modify the public access user profile, and check the field level security permissions for the all the Survey's Objects. It might be some fields with only (or not even) reading access. I gave them read and modify access, and it worked!

I hope this helps you.

FabLavielle commented 4 years ago

Yes, Thank you!! :)

--

Fabienne Lavielle

Salesforce Consultant | Plative

fabienne@plative.com

On Wed, Dec 11, 2019 at 1:03 PM LaureanoF notifications@github.com wrote:

Hi,

I've been through the same issue, and after trying with object acess (creating sharing rules for Contact, Cases, Account) finally I found that it's a field level security permissions.

Modify the public access user profile, and check the field level security permissions for the all the Survey's Objetcts. I might be some fields with only (or not even) reading access. I tried giving them read and modify access, and it worked!

I hope this helps you.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SalesforceLabs/survey-force/issues/32?email_source=notifications&email_token=ALSYULKJ5RLS2R3UK5NLRDDQYFIRZA5CNFSM4DSV3PL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGUR5ZA#issuecomment-564731620, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSYULK6T5E5G7C5WMR2ANTQYFIRZANCNFSM4DSV3PLQ .