There was a recent discussion on LinkedIn about the input variable “recordId”.
Most flow developers know about the special variable “recordId”. (Note: the “I” must be capital, but the “r” can be upper or lower case). In a screen flow, when you set this specific variable as an input and text, it’ll automatically be populated with the Salesforce Id of the current record from where it was called.
What some new developers don’t know is that when you set this variable as an object, it’ll pass the entire object instead of just the record Id. You would do this to essentially save a get operation.
Now, it can seem odd to use a variable called “recordId” to specify an entire record. When a variable has the word “Id” in it, it should just be an Id, right?
I believe that for clarity, recordId should always be a text variable, and then the first step in the screen flow is usually a get operation to get the entire record.
From there, you can reference fields as Get Account.Id or Get Account.Name. This seems more logical to me than using recordId.Id or recordId.Name.
The takeaway
- Naming conventions matter. If you call a variable “RoomName”, you shouldn’t store an Id.
- You don’t need to think about what object recordId refers to.
- Yes, it uses an unnecessary get operation, but screen flows usually have multiple screen steps, which completes the transaction. So you’ll probably never encounter DML operation limits.