0

I have a junction object called relationships. It is tied to Projects and Accounts. I am just trying to create a custom list button that adds a new record.

So far I have this: window.open("{!URLFOR($Action.Relationship__c.New)}");

Settings are on execute javascript but I tried all the other settings too. It always leads to a broken page. Have tried many variations--anyone have any advice on how to simply create a new record? The reason I do not want to use the original "New Relationship" button is because I want to change the label to something more custom "New Account" on the project object, and "New Project" on the account object.

thanks!

  • Answer: 1. Behaviour : Display in existing window without sidebar and header 2. Content Source : URL 3. Code: {!URLFOR($Action.Relationship__c.New,null)}; – sfdcstack Sep 25 '16 at 0:07
0

the URL for parameter requires two inputs, the Action, and the ID for the record.

When I do what you have I get a JS error. However when I do this I get the correct URL:

window.open("{!URLFOR($Action.Relationship__c.New,null)}");

If you want to see what is being returned to troubleshoot use this:

alert("{!URLFOR($Action.Relationship__c.New,null)}");

Then copy and past the url and see where it takes you.

| improve this answer | |
  • Thanks for this! The following did the trick: Settings: 1. Behaviour : Display in existing window without sidebar and header 2. Content Source : URL 3. Code: {!URLFOR($Action.Relationship__c.New,null)}; – sfdcstack Sep 25 '16 at 0:02
  • @sfdcstack - YW. General practice it to accept an answer that resolves your question. This allows others with the same issue to find answers. – Eric Sep 25 '16 at 1:06
0

Here are steps to implement.

  1. List View button
  2. Behaviour : Display in existing window without sidebar and header
  3. Content Source : URL
  4. /a2A/e

Here 'a2A' is custom object first 3 characters of id.

| improve this answer | |
0

The following did the trick as per the help above. I had some issues in the code.

Settings: 1. Behaviour : Display in existing window without sidebar and header 2. Content Source : URL 3. Code: {!URLFOR($Action.Relationship__c.New,null)}; –

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.