function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rfgrfg 

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:

User-added image

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?
SwethaSwetha (Salesforce Developers) 
HI Sarah,
Let me know if the steps in below articles help
https://developer.salesforce.com/forums/?id=906F0000000BR6AIAW 
https://trailblazers.salesforce.com/answers?id=9063A000000ppdxQAA

Happy to answer follow up queries.Thanks
Michal HruškaMichal Hruška
Hi Sarah,

[{"name": "this is the name of Input Variable used in the flow", "type": "String", "value": {!record.Id}}]

fore the value please use record.Id - no Record.Id with upper case R - it helped me.

https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMYinUAH
https://salesforce.quip.com/AgKjAEz9UDfI
ZavoqZavoq

Correction:

[{"name": "this is the name of Input Variable used in the flow", "type": "String", "value": {!recordId}}]

Austin MusserAustin Musser
Can someone help me figure out the format to pass in the opportunity Id? I am trying to run the flow modal on an opportunity record. Thanks
Dimitri MitsiosDimitri Mitsios
try this one

[   {      "name" : "var_inp_id", "type" : "String", "value": "_RECORDID_"    } ]

var_inp_id is the input variable as is defined on the flow
Carlos MateusCarlos Mateus
This one works perfect !