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
Ola BamideleOla Bamidele 

Automatically update website URL in visual force page

Hi Gurus,

I have created a form in VF that is linked to a custom object in Salesforce. After the form is completeed, the user is automatically directed to the home page of my website - as I done via an extention apex page. 

However if I was to change my website, I will have to keep changing my code - which I obivously do not want to keep doing.

So how can I update my website URL without entering my VF code? I was told I could use a static resource but i'm yet to understand how it can be achieved using it even after research

Please if anyone knows how it can be achieved let me know, thanks very much!
 
Best Answer chosen by Ola Bamidele
Ayub AnsariAyub Ansari
Why don't you add your code!

BTW you have written your code as below:
 
PageReference rpage = new PageReference('www.webiste.com');
redirect rpage;

I am just saying create a custom label with name WebsiteURL and keep the web address in the custom label's value. And update code as below use custom label.

PageReference rpage = new PageReference(Label.WebsiteURL );
redirect rpage;



 

All Answers

Ayub AnsariAyub Ansari
What does it means "home page of my website - as I done via an extention apex page." ....are you apex controller to redirect to website? If yes, then why not you are using custom label and keep that website address in custom label. So that in future if you need to update the website address then you can just do by updating the label.

 
Ola BamideleOla Bamidele

Hi Ayub,

Yes the apex entention redirects my form to my website apon completion. & how can I use a custom label to achieve this?

Thanks
Ayub AnsariAyub Ansari
Why don't you add your code!

BTW you have written your code as below:
 
PageReference rpage = new PageReference('www.webiste.com');
redirect rpage;

I am just saying create a custom label with name WebsiteURL and keep the web address in the custom label's value. And update code as below use custom label.

PageReference rpage = new PageReference(Label.WebsiteURL );
redirect rpage;



 
This was selected as the best answer
Ola BamideleOla Bamidele
Hi Ayub, 

The custom label worked well, thanks for the help!