I am trying to use the 'Launch Flow in Modal' component in a Lightning Community. I'm placing this button on a Contact record detail page in the Community, and I want to pass the Contact Id to the flow as the input variable 'recordId'.

The options for the component include a field called Flow Input Variables, and the 'info' tooltip for that field gives a syntax example for a JSON string to set the variable that looks like this:

enter image description here

I can't figure out how to get the record Id of the current contact from the contact detail page inserted into the flow.

First I tried

[{"name": "recordId", "type": "String", "value": {!Record.Id}}]

but that throws this error:

SyntaxError: JSON.parse: unexpected character at line 1 column 51 of the JSON data

I figured the brackets around the variable were the problem so I tried escaping them with backslashes:

[{"name": "recordId", "type": "String", "value": \{!Record.Id\}}]

but got the same error.

What's the right way to reference the Id of the current record from a community record detail page to pass to a flow?


Does the {!Record.Id} part need to be surrounded by quotation marks?

[{"name": "recordId", "type": "String", "value": "{!recordId}"}]
  • I tried that too, that makes it valid JSON but then it just passes the text string "{!Record.Id}" as the variable, so the flow fails to fetch a record. I'm not sure how to pass the record id as a variable and include it in the JSON with valid syntax. – rg_ Aug 31 '20 at 21:59
  • Sorry, it needs recordId rather than Record.Id - I've edited the post – Instread Aug 31 '20 at 22:12
  • that did it, thank you! – rg_ Aug 31 '20 at 22:29

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.