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!

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

3 Answers 3

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.

2
  • 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
    Commented Sep 25, 2016 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
    Commented Sep 25, 2016 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.

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)}; –

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .