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

Custom Button with Java Script or Visualforce?

Not sure if this is the correct forum, but lets give it a shot, I'm using the standard object, Account, which has a related custom object, JTA. 

Trying to create a custom button to show on the Account's related list properties Butons.  

I first created a List Button (see image 1) with settings shown and with no syntax errors. This is the syntax used:

I then placed the custom button onto the Account's Related List Properties - JTAs (screenshot #2).

When accessint the New Action Setup button, it produces a pop up window with the following error (screenshot #3): 

A problem with the OnClick JavaScript for this button or link was encountered: 
Unexpected token &

I haven't created any other content (e.g., visual force page, or apex controllers) that I may be missing in all this? 

Custom Object Name: JTA
Custom Button Name: New Action Setup

Screenshot #1

Screenshot #2

Screenshot #3
Best Answer chosen by HNT_Neo
Pramodh KumarPramodh Kumar
User-added image
please use like this..

All Answers

Pramodh KumarPramodh Kumar
JTA__c.Id is null

and what exactly you want to do there, could you please explain your use case.
I would like the New Action step button to create a new JTA record
Pramodh KumarPramodh Kumar
in the step 2 image just chek the new checkbox under the standard buttons then you can have ability to add the new record.

Hey Pramodh, 

I don't want to use the standard button, since it is named "New JTA", but I do want that functionality on the custom button, "New Action Step". 

Management wants the button renamned and doesn't like the button name of "New JTA". The only other way to get the button renamed is to change the entire custom object name from JTA to Action Step, but I want to avoid that if instead a custom button can be created to create a new JTA record. 

Pramodh KumarPramodh Kumar
Hey Neo i found the solution for your problem
  • First in the page layout include the standard button and save the page layout and then go to the parent object record from there open the new JTA record
  • Copy the URL and paste on your new button 
  • for example this is my new related list url  "/a3X/e?CF00NK0000001gkoy=i+Phone+plus+plus&CF00NK0000001gkoy_lkid=a3YK00000000VXi&retURL=%2Fa3YK00000000VXi"
  • Here remove the name and id which are populating from the new standard list button
  • "/a3X/e?CF00NK0000001gkoy={!}&CF00NK0000001gkoy_lkid={!}&retURL=%2F{!}"
  • and save the button

let me know if you still facing any problem

Still didn't work but here is what my syntax looks like: 


Pramodh KumarPramodh Kumar
instead of JTA please put parent object API name not your related list object id

the parent object is Account
Pramodh KumarPramodh Kumar


Here's the error I receive when enter the syntax onto the button:

Unexpected Identifier
Pramodh KumarPramodh Kumar
User-added image
please use like this..
This was selected as the best answer
Thank you so much Pramodh!!!
Pramodh KumarPramodh Kumar
You're welcome