2

Have a record triggered flow and set variable name as recordId, type=record. The recordId is set as input and output. When I debug the flow and pick a named record as input recorId is set to null. Issues remains with trigger set to created and created/updated record. Is it not possible to grab the recordId using the flow debugger ? Same null result when setting text var as RecordId to the $Flow.CurrentRecord.

2 Answers 2

1

$Flow.CurrentRecord is a Record, not an Id. If you want the Id, use $Flow.CurrentRecord.Id. Just creating a variable called recordId won't automatically give you the Id in a record-triggered flow. This parameter would be useful for other kinds of Flow scenarios, such as making an Action that calls a Flow.

3
  • Thanks sfdcfox. Assume we can pull the recordtype as $Flow.CurentRecord.RecordType,Name as well ?
    – rickmac
    Commented May 17 at 3:57
  • @sfdcfox I could argue differently, $Flow.CurrentRecord contains only the record Id as it is a text variable and not a record variable and as such $Flow.CurrentRecord.Id will not work. I would recommend using $Record to get all the information you need for the record that triggered the flow. Commented May 17 at 6:36
  • 1
    Agree. This is something I noticed before the question as well. Doing too many screen flows and once in a while a pure trigger. Thank you.
    – rickmac
    Commented May 17 at 13:18
3

For record triggered flows the record that triggered the flow is automatically stored in the global variable {!$Record}. You do not need to create a variable to store it as you can directly access it and any of the fields on the record:

  • recordId = {!$Record.Id}.
  • Record Type Name = {!$Record.RecordType.DeveloperName}

I would thus not recommend using $Flow.CurrentRecord as that only gives you the record Id of the record that triggered the flow and you can get all you need with {!$Record}.

I created a GIF to show you the difference:

enter image description here

  • recordId is a text variable and I can assign {!$Flow.CurrentRecord} to it as it is also text (the record that triggered the flow's record Id).
  • record is an Account record variable and you can see I cannot assign {!$Flow.CurrentRecord} to it, as {!$Flow.CurrentRecord} is not a record variable, but a text variable.
  • I can assign {!$Record} to record as they are the same type (Account record variable).

Good luck!

5
  • Thanks Adriaan. I appreciate your attention to detail ! "Future Others' that come across this will benefit as well !
    – rickmac
    Commented May 17 at 13:21
  • @rickmac no problem - I also learnt something new with regards to {!$Flow.CurrentRecord} Commented May 17 at 13:23
  • Interesting to note that the $record is referred to as 'Triggering <obj> ' in the decision elements but as $Record in the assignment elements. Does the same thing. For deign and debug logs will create a unique var to hold the explicit values of $record.developerName, $record.ID,..... Flow is cleaner that way and will help with any formulas.
    – rickmac
    Commented May 17 at 15:14
  • Sounds good. Readability is really important especially if others will use it later. Commented May 17 at 16:24
  • @rickmac do you mind changing the accepted answer to mine? This is to ensure the answer is more visible to others in the future. Thanks 🙏 Commented Jun 1 at 13:03

You must log in to answer this question.

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