function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Veerle RuttenVeerle Rutten 

Surveyforce - Authorization Required screen for Guest Site User when using html template

Hi,

I have set-up surveyforce to use surveys related on case and contacts.
Sharing settings and apex access has been configured correctly  for my Gues Site user.

When using below url in a text email template, it is getting merged correctedly and works fine:
http://config-config.cs3.force.com/surveyforce/TakeSurvey?id=a1vQ0000000kVMgIAM&cId={!Contact.Id}&caId={!Case.Id} 
In the sent email this displays as:
http://config-config.cs3.force.com/surveyforce/TakeSurvey?id=a1vQ0000000kVMgIAM&cId=003Q000000XOqLE&caId=500Q00000066Kma
and when clicking the link it opens in browser as:
https://config-config.cs3.force.com/surveyforce/TakeSurvey?id=a1vQ0000000kVMgIAM&cId=003Q000000XOqLE&caId=500Q00000066Kma
It works fine and when an external user complets the survey, the thank you page appears and the answers are registered in Salesforce.

When we try to achieve the same using an html-template however, the external user gets an 'authorization required' error message when trying to submit.
Link in the template:
http://config-config.cs3.force.com/surveyforce/TakeSurvey?id=a1vQ0000000kVMgIAM&cId={!Contact.Id}&caId={!Case.Id}
Displayed in the email:
http://config-config.cs3.force.com/surveyforce/TakeSurvey?id=a1vQ0000000kVMgIAM&cId=003Q000000XOqLE&caId=500Q00000066Kma
But when clicking this link from the email, the ID's are not merged:
https://config-config.cs3.force.com/surveyforce/TakeSurvey?id=a1vQ0000000kVMgIAM&cId=%7b!Contact.Id%7d&caId=%7b!Case.id%7d

=> when submitting answers on this link, the user gets an authorization required message.
In the user log debug for Guest Site user I can see an error:
2:31:37.0 (31994164)|METHOD_EXIT|[503]|01pQ00000003Jev|ViewSurveyController.AddSurveyTaker() 12:31:37.0 (31999450)|SYSTEM_MODE_EXIT|false 12:31:37.0 (32076237)|FATAL_ERROR|System.StringException: Invalid id: {!Contact.Id}

Hoow can we make sure the ID's are merged correctly using html templates?