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
HNT_NeoHNT_Neo 

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:
 
/00U/e?who_id={!JTA__c.Id}&retURL=/{!JTA__c.Id}&cancelURL=/{!JTA__c.Id}&ent=JTA

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.
HNT_NeoHNT_Neo
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.
HNT_NeoHNT_Neo

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={!yourobjectAPIname.name}&CF00NK0000001gkoy_lkid={!yourobjectAPIname.id}&retURL=%2F{!yourobjectAPIname.id}"
  • and save the button

let me know if you still facing any problem
 
HNT_NeoHNT_Neo

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

 

/a2j/e?CF00NJ0000001sr6T={!JTA__c.Name}&CF00NJ0000001sr6T_lkid={!JTA__c.Name}&retURL=%2F{!JTA__c.Name}
Pramodh KumarPramodh Kumar
instead of JTA please put parent object API name not your related list object id



/a2j/e?CF00NJ0000001sr6T={!parentObject.Name}&CF00NJ0000001sr6T_lkid={!parentObject.id}&retURL=%2F{!parentObject.id}
HNT_NeoHNT_Neo
the parent object is Account
Pramodh KumarPramodh Kumar

/a2j/e?CF00NJ0000001sr6T={!account.Name}&CF00NJ0000001sr6T_lkid={!account.id}&retURL=%2F{!account.id}
HNT_NeoHNT_Neo

Here's the error I receive when enter the syntax onto the button:
/a2j/e?CF00NJ0000001sr6T={!Account.Name}&CF00NJ0000001sr6T_lkid={!Account.Id}&retURL=%2F{!Account.Id}


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