I have a custom button that lives on the Contact page layout that fires a flow when clicked. I'm trying to feed the Contact's Account ID in the parameters so that when the flow finishes, it redirects to the Account page.

var url = ('/flow/[FLOW NAME]?ContactId={!Contact.Id}&retURL={!Account.Id}');


Problem is, it occasionally seems to feed the wrong Account ID into the URL, resulting in a 404 page.

URL No Longer Exists You have attempted to reach a URL that no longer exists on salesforce.com.

Sometimes it works and sometimes it doesn't -- I can't seem to find a reason either way. I've confirmed that the ones that are failing have valid Accounts they're attached to, so I'm not sure why else it would be fed the incorrect parameter. Any ideas?

1 Answer 1


Try this:

../flow/[FLOW NAME]?ContactId={!Contact.Id}&retURL=/{!Account.Id}

(The .. allows your Flow button to work in a Community)

You might be missing the "/" in your retURL?

  • Didn't seem to help. The problem seems to be that the {!Account.Id} variable is pulling in the wrong ID entirely. For example, the test contact I'm using is attached to an Account with ID "001A000001DXb7a" but the ID the button is pulling is "5130f0a58989846a3602f64c" -- I've verified this isn't something happening later in the process by just trying a simple alert('{!Account.Id}'); script also (it shows the wrong ID in this case too).
    – Matt
    Commented Aug 2, 2016 at 17:17
  • Is the variable coming into the Flow correctly? Or is it from the start of your Flow pulling a different ID? Commented Aug 2, 2016 at 23:40
  • No, it's not coming into the Flow correctly -- my example above was the variable for the Account ID should be "001A000001DXb7a" but instead it's going into the Flow as "5130f0a58989846a3602f64c"
    – Matt
    Commented Aug 3, 2016 at 3:47
  • Can you try this with just a straight URL instead of using the script? Commented Aug 3, 2016 at 3:55
  • 1
    Have you tried creating a custom account ID field on the Contact? Lame, but maybe that standard merge field has some issue Commented Aug 3, 2016 at 22:22

You must log in to answer this question.

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