0

I have this Apex page which starts a flow which I would like to give an dynamic Id from my controller how would I write the syntax see my page:

<apex:page controller="NavigateToContactController">
    <flow:interview name="LerarenCommunity_Licentie_Verlenging" finishLocation="{!URLFOR('/....ID....')}">
        <apex:param name="varProfielId" value="{!getLoggedInUserContact}"/>
    </flow:interview>
</apex:page>

I want to replace ID with {!getLoggedInUserContact} I tried:

"{!URLFOR(\'/{!getLoggedInUserContact}\')}"

But I get a Syntax error

2 Answers 2

4

Don't merge within a merge.

{!URLFOR(\'/{!getLoggedInUserContact}\')}
            ^^       redundant      ^
^^    you are already within a merge    ^

Also, unless you named some method getGetLoggedInUserContact, you should remove get from the property name.

Also, you need a concatenation operator (&).

Also, you don't need to use URLFOR if you are constructing a literal url.

Putting it all together:

finishLocation="{!'/' & loggedInUserContact}"

It would be better to use the more standardized $Action global variable:

finishLocation="{!URLFOR($Action.Contact.View, loggedInUserContact)}"
4
  • I do have a method named getloggedInUserContact. I tried your solution but get : Unknown property 'NavigateToContactController.getLoggedInUserContact'
    – Jenssen
    Commented Oct 2, 2017 at 23:54
  • If you get that error, you didn't try what I recommended. If you have a method named getSomeProperty, then you have a method named someProperty. That's why you would change it in your markup to reference loggedInUserContact. You would only reference a property named getSomeProperty if you had a method named get**Get**SomeProperty.
    – Adrian Larson
    Commented Oct 3, 2017 at 0:38
  • Sorry I misunderstood. But still: <apex:param name="varProfielId" value="{!LoggedInUserContact}"/> with a static finish location works. When I change the static part for "{!URLFOR('/' & loggedInUserContact)}" I get the error: URL No Longer Exists
    – Jenssen
    Commented Oct 3, 2017 at 0:53
  • Thanks for your help but I managed to figure it out
    – Jenssen
    Commented Oct 3, 2017 at 1:10
-1

Found the solution: finishLocation="{!URLFOR('/{!LoggedInUserContact}')}"

6
  • That shouldn't compile.
    – Adrian Larson
    Commented Oct 3, 2017 at 1:34
  • @Adrian Actually it does and is working fine, but thanks anyway
    – Jenssen
    Commented Oct 3, 2017 at 1:58
  • 3
    It shouldn't work; if it does work, it's a bug. Use Adrian's code instead.
    – sfdcfox
    Commented Oct 3, 2017 at 3:31
  • @sfdcfox Thanks for helping I tried the solution of Adrinn but as stated above I get the error: URL No Longer Exists.
    – Jenssen
    Commented Oct 3, 2017 at 3:42
  • Did you ever try using the more standard $Action global variable?
    – Adrian Larson
    Commented Oct 3, 2017 at 12:44

You must log in to answer this question.

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