[SalesForce] How to pass record ID to ‘Launch Flow in Modal’ component in Lightning community

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?

Best Answer

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

[{"name": "recordId", "type": "String", "value": "{!recordId}"}]
Related Topic