Closed Lukexi529 closed 3 years ago
Can you tell me what is line#57 on Apex Class ViewSurveyController.cls?
What is the URL that you are trying to access?
If I think this is the right line then this error may show up if "/apex/takesurvey?id=a0xxxxx" (URL of the survey) is missing the Survey ID; that is required
Hi Jrattanpal
Much appreciated for the response.
This is the public link which is sent to the client to fill https://mandarinconsultant.secure.force.com/PreConsultationSurvey/TakeSurvey?id=a0C4H00000hWTSPUA4&cId=&caId=none
I am not too sure on where I can get the Apex Class ViewSurveyController.cls? Could you let me know where I can get the full codes? Is it under Settings/Visualforce pages/TakeSurvey?
Many thanks
URL looks good but, unfortunately, I can't tell you the issue by just looking at it. You can find Apex classes in Setup and look for Classes in "Quick Find".
You has mentioned that it was working and suddenly stopped. I wonder if it has to do something with Winter'20 and new restrictions around Guest users.
With new changes, Guest users cannot access those records directly so you need to create new sharing rules for your Guest user and survey records. This is mentioned in documentation at https://github.com/SalesforceLabs/survey-force
In addition, what is the version of Survey Force do you have? There have been many changes to this package to account for these new changes to Guest account security. Some steps on how to upgrade the package are mentioned in the above location.
Thanks, found the class page now and I will check the link you sent. This is the version info which was directly copied from the installed package page
Uninstall | | Survey Force | Salesforce.com | 2.47 | | N/A | N/A | N/A | N/A | 21/05/2020 15:32 | | 2 | 4 | 4 | Not Applicable
Below is the code from line 45 to 80. Yes it stopped suddenly and even myself as an Admin cannot access to the survey link that I just sent to you, which looks weird. It stopped from Saturday. The only change I've made in Salesforce on that day was that I changed the profile of an inactive user (who was the first admin user for my org 5 yrs ago) from 'system admin' profile to something else. Apart from that, I didn't touch anything on that day. Not sure if there is any connection between them.
public ViewSurveyController(ApexPages.StandardController stdController) {
// Get url parameters
surveyId = Apexpages.currentPage().getParameters().get('id');
caseId = Apexpages.currentPage().getParameters().get('caId');
contactId = Apexpages.currentPage().getParameters().get('cId');
if(caseId ==null || caseId.length()<15){
caseId = 'none';
}
if(contactId ==null || contactId.length()<15){
contactId = 'none';
}
surveyId = String.escapeSingleQuotes(surveyId);
caseId = String.escapeSingleQuotes(caseId);
contactId = String.escapeSingleQuotes(contactId);
// By default the preview is not showing up
renderSurveyPreview = 'false';
init();
}
public ViewSurveyController(viewShareSurveyComponentController controller)
{
surveyId = Apexpages.currentPage().getParameters().get('id');
caseId = Apexpages.currentPage().getParameters().get('caId');
contactId = Apexpages.currentPage().getParameters().get('cId');
if(caseId ==null || caseId.length()<15){
caseId = 'none';
}
if(contactId ==null || contactId.length()<15){
contactId = 'none';
}
surveyId = String.escapeSingleQuotes(surveyId);
caseId = String.escapeSingleQuotes(caseId);
contactId = String.escapeSingleQuotes(contactId);
The code looks good. That means it's possible it could be related to Winter'21 (Sorry, not Winter'20).
Your package version is an older one; latest is 2.53. You should upgrade your code and go through all the instructions mentioned at https://github.com/SalesforceLabs/survey-force (Specifically related to Guest user and sharing rules).
That is the only thing I can think of. These are the latest changes for Guest users which have been enforced in the latest release; https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_networks_guest_user.htm
These are all the changes that have happened around Guest user in general: https://help.salesforce.com/articleView?id=networks_guest_policies_timelines.htm&type=5
Hi Jrattanpal
Thanks and I've reviewed the links you provided. As per the note from the link, It seems that the guest user cannot even be added into the public group? In that case, how can we assign sharing rule to them provided only groups and roles are available from the pickup list?
" Securing access to records by guest users Guest user external org-wide defaults are always set to private. Guest users can’t have more than read access to data. Guest users can’t be members of public groups or queues. Guest users can’t access records via manual sharing. " Is there any workaround or it means the Survey Force cannot be used by external users in future following the 21 release?
Best
You should be able to add a sharing rule directly for the guest user without having to add it to a public group. I have been doing that for a while so shouldn't be an issue
Amazing! It works. The issue is just due to the 21 release on the guest user. I created the sharing rule based on the field of 'share with guest user' then problem solved! Myself and all guest users have gained the access back.
Does it mean that all guest users were previously granted with access on 'Survey' object or other custom objects by default but moving forward we have to share to them manually?
@jrattanpal We are having a similar issue- our guest users are receiving an "Authentication Required" screen when they click the link to take the surveys we sent them which were previously working. We updated to the latest Survey Force package by upgrading the source code directly. We have made sure that we have:
Still, our survey link is not working. Do you have any other ideas of things we should look into or try? Please advise.
@LukeLXi I am not sure how those permissions were assigned on your org but yes, Guest user should've had Read access to survey object. With new changes, Guest users can't see those records unless exclusively shared by admin like you did now. This makes for better and explicit security.
@JBrownDCS Looking at that list, everything looks good. I am not sure what the issue maybe.
Can you create a new issue and attach Apex log files? That should tell you where it's failing.
I believe this issue was fixed. I will close this for now but please reopen it (with new logs) if this issue persists.
Hello,
We've been using Survey Force for four months now and everything worked well until this morning. All of sudden I and all my people, as well as external clients, lost access on the survey page.
It says 'Authorization Required You must first log in or register before accessing this page. If you have forgotten your password, click Forgot Password to reset it.' on the survey page which we could open without any issues before today
Below is the error I've seen from the debug log
Could you advice what I can do now?
Application | Browser | /apex/TakeSurvey | Argument cannot be null. | 119 | 1,541
and the error message I received by email
**Apex script unhandled exception by user/organization: 00524000001fHdY/00D24000000aVwj
Visualforce Page: /apex/TakeSurvey
caused by: System.NullPointerException: Argument cannot be null.
Class.ViewSurveyController.: line 57, column 1**
Many thanks