SalesforceLabs / survey-force

89 stars 64 forks source link

Bad Request #153

Open spuramsh1 opened 1 year ago

spuramsh1 commented 1 year ago

Hello, we have enabled enhanced domain in our sandbox environment and now while using the community site URL always gives bad request error message on submission of survey. Please help. Also tried modifying the class ViewShareSurveyComponentController as per the changes suggested but still it didn't help.

image

jrattanpal commented 1 year ago

Hi,

Can you provide more details? Apex debug logs?

Are the survey responses being recorded? If yes then have you used any THank you URL? Maybe that URL doesn't work anymore?

We have users who used the survey with enhanced domain and it has been working fine. No issues were repoted

Message ID: @.***>

spuramsh1 commented 1 year ago

The problem is no survey response is being recorded and there is no log being captured in backend which is really confusing. The survey loads properly but which I click submit after entering all the details it gives me this error.

jrattanpal commented 1 year ago

I am not sure. This has something to do with Enhanced domains.

After you enabled enhanced domain, did you deploy it?

(It worked for me when I tested so not sure what maybe the issue)

spuramsh1 commented 1 year ago

Yes, I deployed it. Can you provide me how the survey URL was being formed in your case. As soon as I made changes on ViewShareSurveyComponentController I was able to see two options under select site on survey page where you click on Open Survey(New Window) any idea why it happen?

jrattanpal commented 1 year ago

In the old code, enhanced domains were not accounted for. I made the change to account for enhanced domain because of some minor changes on how the information is stored in Site and SiteDetail objects.

After you deployed my code, the site is now listed there. Without that code, you will not see the site after enhanced domain.

spuramsh1 commented 1 year ago

can you please help me with providing the survey url how it was formed. I see there is an extra "s" character being appended so if you provide me how the url forms that would be very helpful

jrattanpal commented 1 year ago

That URL is created in https://github.com/SalesforceLabs/survey-force/blob/main/force-app/main/default/classes/ViewShareSurveyComponentController.cls

Getter: sitesPicklist (Line# 52)

It queries "Site" and "SiteDetail" objects to get the URL dynamically. If you had a previous site and now enabled Enhanced domains, it maybe because of that.

You can run those 2 queries in Salesforce Developer Console (Query) and see what is in your org