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
MikeBates.ax895MikeBates.ax895 

Custom Buttons and Links : adding lookup object fields as url params

I'm trying to create a custom Link (or Button) that will open up an apex page I built and have 2 problems.

 

First problem

I've been trying to use the page as a Content Source as it's not listed, looking at various threads on this I have this on my page

 

<apex:page standardController="Booking_Sheet_Tick_Box__c" extensions="BookingSheetExtension">

 

Then I have an apex class BookingSheetExtension

 

public class BookingSheetExtension
{
	// Class variables
	...
	private final Booking_Sheet_Tick_Box__c bookingSheetObj;
	
	// Constructor	
	public BookingSheetExtension( ApexPages.StandardController controller )
	{
		this.bookingSheetObj = ( Booking_Sheet_Tick_Box__c )controller.getSubject();
		this.apiGetBookingSheet();
	}

	...

}

 I can open the page by typing in the url and it works fine. But it won't appear as a Content Source for my custom links and buttons.

 

 

Second problem

I gave up on this and just used Content Source = URL then put "/apex/My_Page?....." in the editor field. That works, to an extent, but now I can't get it to add in a value from a lookup field.

 

I'm adding the link to a custom object Procedure__c. In Procedure__c I have a Lookup to another custom object Procedure_Type__c (this has to be an object bttw, I can't just use a picklist)

 

I want the link to grab one of the fields from Procedure_Type__c for my custom link but it isn't being populated in the link

 

This is what I actually have in the editor field "/apex/Booking_Sheet?procedure_type_id={!Procedure_Type__c.External_Type_Id__c}"

 

and that opens up the page with the url "http://[salesforce.url]/apex/Booking_Sheet?procedure_type_id="

 

I've checked the objects that I'm using and they are all in the Procedure lookup, and they have a value for External_Type_Id__c

 

Does anyone have any ideas on what I could be doing wrong? I'm mostly interested in problem 2, but it would be nice to get problem 1 sorted out as well.

 

Thanks,

Mike

 

 

 

Pradeep_NavatarPradeep_Navatar

A visual force page is listed as a content source to an link/button for an object, if and only if you are using that object as standard controller in page.


For an example if you want to create a link for account object and want to get open VF page, so you need to define account as standard controller in this page in order to listed it as content source. In formula editor for custom link, you can not not access other object's field.