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
Jeremy McLeod 4Jeremy McLeod 4 

Getting the RecordId passed to a flow in Field Service Lightning

Hi Everyone,

I am currently working on a Flow for Field Service Lightning that after a series of questions being asked, updates a record. The problem I am having is that I do not know how to pass the RecordId into my Flow from the record I was on in the Field Service Lightning app. Any help would be appreciated.

Thank you,

Jeremy
Alain CabonAlain Cabon
Hi Jeremy,

Andy in the cloud wrote an article:  "By creating an Input variable in your Flow called recordId of type Text (see docs). Lightning App Builder will automatically pass in the record Id. You can also expose other input parameters, e.g. CustomMessage so long as they are Input or Input/Output."

https://andyinthecloud.com/2016/08/30/flow-in-winter17-lightning-experience/

Have you declared the interface: force:hasRecordId​   Add the force:hasRecordId interface to a Lightning component to enable the component to be assigned the ID of the current record.   <aura:attribute name="recordId" type="String" />
 
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
  <aura:attribute name="recordId" type="String" />   
   <!-- ... -->    
</aura:component>
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_interfaces_force_hasrecordid.htm​

Regards
Jules Faligot 16Jules Faligot 16
Hi Jeremy,
Did you find out how to pass the record id to flow launched with Field Service Lightning Mobile App?
Søren LandschultzSøren Landschultz
Hi Jules,

I read the instructions under 'Flow Considerations' here: https://help.salesforce.com/articleView?id=mfs_flow.htm&type=5, and after creating a flow input variable called 'Id', my Service Appointment RecordId was automatically passed to the mobile flow.
Angelina MuddamalleAngelina Muddamalle
Hi Alain,
I have implemented your suggestion of creating a recordId variable in my lightning component; but the value is not getting passed to the recordId variable on the flow for some reason. Is there a work around for this?
Andrew-LukasiewiczAndrew-Lukasiewicz
Thanks Soren! Huge help! +1
Abdallah MenouerAbdallah Menouer
+1 Soren.
And if by any chance you want your Field Service Flow to be accessible from both the Mobile app and the Desktop. create two input variables, one named 'recordId' and the other just 'Id' and make a condition to pass whichever is not empty.