SalesforceLabs / survey-force

85 stars 61 forks source link

Bug on Extern/Email Link Anonymous survey: header is not the headername! #34

Closed Nebeor closed 4 years ago

Nebeor commented 6 years ago

When I open a survey as a service, The name of the survey is shown, instead of the header name. this is my fix:

ViewSurveyController.apxc: added two vars:

public String surveyHeader                {get; set;}
public Boolean hideSurveyName       {get; set;}
...

public void setSurveyNameAndThankYou(String sId){
        Survey__c s = [SELECT Name, Id, URL__c, Thank_You_Text__c, thankYouText__c, thankYouLink__c, Survey_Header__c, Survey_Container_CSS__c, Hide_Survey_Name__c FROM Survey__c WHERE Id =:sId];
        surveyName = s.Name;

        surveyHeader = s.Survey_Header__c;
        hideSurveyName = s.Hide_Survey_Name__c;

        templateURL = s.URL__c+'id='+sId;//+'&cId={!Contact.Id}'+'&caId='+'{!Case.id}';
...

TakeSurvey.vfp:

<apex:outputPanel id="seeSurvey" rendered="{! If((Survey__c.Hide_Survey_Name__c == false || Survey__c.Survey_Header__c != ''), True, False )}" >
                <div class="slds-box slds-theme--shade">
                    <div class="slds-text-heading--large"><apex:outputText value="{!surveyHeader}" escape="false" /> </div>
                    <apex:outputPanel rendered="{!hideSurveyName == false}">
                        <div class="slds-text-heading--medium">{!Survey__c.Name}</div>
                    </apex:outputPanel>
                </div>
            </apex:outputPanel>

Edit: Actually This workaround is not needed, the right way to fix this issue is by changing the access rights on the survey__c: By default these are not all accessible from outside.

ivanars1 commented 6 years ago

Hi Nebeor,

To be able to see the header as an external user, I changed Survey Field-Level Security for profile and that worked. Then, I realized survey name is always shown for the external user. Using that "Hide Survey Name" checkbox is not working...

Do you have any idea how to solve this?

Thanks, Ivan

jrattanpal commented 4 years ago

I just tested it and it worked for me.

i am closing this for now. But if it still doesn't work then can you log a new issue with steps to reproduce it?

Thanks