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
dietcoladietcola 

custom button

Hi, everyone-

 

I'm trying to get the button (circled in green) pictured below to reference whatever Training is entered.  Basically, I want the button to do the exact same thing that clicking on the actual words "Controlling Powers Demonstration" would do.  Is that possible?

 

 

Thank you in advance!

Best Answer chosen by Admin (Salesforce Developers) 
SteveBowerSteveBower

What if, instead of URL, you use an execute Javascript button and have the javascript be:

 

navigateToUrl('{!URLFOR($Action.Training__c.View, Returning_Volunteer_Enrollment__c.TrainingId__c )}');

 

 

(I'm using Training__c as the name for your Training object, however I don't know what it really is, so change it as needed.)

 

Best, Steve

All Answers

shillyershillyer

Is that a lookup to your training object? If so, make your custom button point to this URL:

 

/Object_c.TrainingId__c

 

This will redirect the URL to the training record ID.

 

Hope that helps,

Sati

dietcoladietcola

Think I'm missing something.  I have "Detail Page Button" selected as the Display Type, "URL" selected as the Content Source, and here's all I have in the scary white box:

 

/Returning_Volunteer_Enrollment__c.TrainingId__c

 

It will save just fine, but when I click on the button, it tells me that the URL couldn't be found.  (It is indeed a lookup to my training object.)

 

Thank you for your help so far.  =)

shillyershillyer

That is so odd, it sounds like you have it set up correctly and from the screenshot, you had set the training record in the lookup.

 

If you assign another training record, does it work? I'm wondering if something is wrong with the ID of the current training record.

 

Best,

Sati

SteveBowerSteveBower

What if, instead of URL, you use an execute Javascript button and have the javascript be:

 

navigateToUrl('{!URLFOR($Action.Training__c.View, Returning_Volunteer_Enrollment__c.TrainingId__c )}');

 

 

(I'm using Training__c as the name for your Training object, however I don't know what it really is, so change it as needed.)

 

Best, Steve

This was selected as the best answer
dietcoladietcola

Yes!!  That worked; thank you both so much for your help!!!

 

Oh, this is going to be a good day.