SalesforceLabs / survey-force

88 stars 63 forks source link

URL Redirection for SurveyForce #171

Open DineshARIA opened 9 months ago

DineshARIA commented 9 months ago

As you are aware that Salesforce stops redirections of non-enhanced domains in Winter ’25, starting in August 2024 for sandboxes. We are updating our URLs in our org. There is one class related to SurveyForce that is using hardcoded URL referring host name as 'https://surveyforce-dev-ed--c.na46.visual.force.com'. I would like to get the new URL that can be referenced.

Thanks, Dinesh

jrattanpal commented 9 months ago

We don't have any class with hardcoded code. I am not sure why you have it there. I wonder if someone in your team added it.

The way we built the code, it should automatically pick up the URL of the site where you add this survey.

DineshARIA commented 9 months ago

Sure. Can you tell us how we can use previously used hostname to meet new enhanced domain standards. This is previously used hostname: https://surveyforce-dev-ed--c.na46.visual.force.com I believe it should change to: https://surveyforce-dev-ed--c.vf.force.com based on new standards.

Old : MyDomainName--PackageName.InstanceName.visual.force.com New: MyDomainName--PackageName.vf.force.com1

But, can you confirm it with us?

jrattanpal commented 9 months ago

Here is the code that calculates the URL. getSiteList() in https://github.com/SalesforceLabs/survey-force/blob/main/force-app/main/default/classes/SurveySitesUtil.cls

If you run that query in "Developer COnsole", you can see what it returns

SELECT Name, Subdomain, UrlPathPrefix FROM Site WHERE SiteType = 'Visualforce' AND Status = 'Active'

If it doesn't return then you may need to figure out what it should be. I had tested this on an org with enhanced domains and it worked for me. I wonder why it's not working for you.

Having said that, this is just to generateit automatically to make it easier. You can manually generate that URL if needed.

YOURSITE/TakeSurve?id=SURVEY_ID

That's what it is

DineshARIA commented 9 months ago

Thank you for the response, I am aware of this change and I can find my site info. I am specifically taking about 'ViewShareSurveyComponentController_Test' class on line 6 which specifies host name that is referring to your instance. You can find it in your given package. Can you help me what would be the new enhanced URL would be related to it?

jrattanpal commented 9 months ago

Those tests were for packaging as we need to run. You own that code and can edit it to and add your site URL there.

I can't tell you what the new URL will be, if you go to any of your Survey and use that "Share" component, it may generate the URL for your site that you can use.

You should also be able to to go to Setup->Sites, open your site and see the URL; that is the URL in that test class