+ Start a Discussion

Question on trigger / Class



I have an ideas site, and in the idea detail page (when a particular idea is choosen the user is navigated to this page), i have a java script to generate url for that particular idea so that user could email the link with a click of a button. Our internal org has requested for url's for all the ideas submitted so far and future ideas with respective to their title in reports. Do i need to write a trigger (& where do i save url's?). i can use a specific portion of static url hardcoded  http://xxxxxxxxxxxxxxxx/ideaView?"id=1235487584784" (only id is dynamic here, rest can be hardcoded). can anyone tell me a better way to do this?






you dont need to store entire url in your database. As you mentioned that your javascript code create unique id for each idea and data are accessible through idea id, you can store your URL in custom labels and retrieve that while displaying record on VF page.


I believe Naishadh is referring to Custom Settings, see more information in the “Custom Settings Overview” in the Salesforce.com online help.


Do you need to save the URL in a record? If not then you might think of just displaying it with javascript.


Using window.location.href and cutting out unwanted parameters you can achieve the same and no need for storing it.

Just create the link dynamically using the ID of the idea being seen, or being used in the report.


IF you wanna surface the link as a field in the report, you SHOULD use FORMULA FIELDS to create the link.

The formula fields are read only fields that you can set to be created by a formula in your case :




 Thats the formula value you need. Do not create a new field and fill it with the value, since you can create a formula to be created dynamically without the need for a trigger or any additional logic/code