Flow: Useful Objects That Help You Build A Dynamic Flow!

I often say Flow is not hard or complicated to learn, because there is only a limited number of concepts and elements that we need to know in order to build Flows. However, Flow still provides great flexibility and the key is on the number of objects we can manipulate! If you know these objects well, building a dynamic flow will become very easy. So today, I will introduce some useful objects that help you build a nice and efficient solution!

The most important documentation we will need for understanding the objects can all be found in the Salesforce Developers site. You can find the available fields and their definition. I will attach the links for each object in their headings.

I will constantly update this article. If there are any powerful objects that you often use but are not here, please share with us!

Useful Objects For Building A Dynamic Flow

Here is the official list of all formulas. I will follow a similar categorizing strategy:

  1. Record Type
  2. Profile
  3. Currency Type
  4. Custom Metadata Type and Custom Setting
  5. Permission Set and Permission Set Assignment
  6. Group and Group Member
  7. Content Document and Content Document Link
  8. Email Message and Email Message Relation
  9. Entity Definition
  10. Field Definition
  11. Field Permission
  12. User Record Access
  13. Tips of Learning Objects

“How to avoid hardcode Record Type Id” is one of the most common questions people ask. Some would use Custom Metadata Type to store the Ids, but you don’t really have to do it because you can directly query on the Record Type object!

How To Use

Use Get Records element and either filter on the Name or API Name. If you can add the object filter just to be 100% sure.

Then use the Id from the returned record. You then don’t need to hardcode the Record Type Id in your Flow.

Important Fields

  • Name: The LABEL of the Record Type
  • DeveloperName: The API NAME of the Record Type
  • SobjectType: The belonging object for the Record Type

Back To List

Similar to Record Type, we should try to avoid hardcoding Profile Id in your Flow as well. Luckily, we can also query directly on Profile object.

How To Use

Use Get Records element and filter on the Name, which is the profile label.

Important Fields

  • Name: The LABEL of the profile.
  • UserType: The user license type of the profile.

Back To List

If you have multi-currency enabled and want to create multiple pricebook entries at once, you can utilize the Currency Type objects. You can get all the available currencies and loop through them to get the ISO code.

How To Use

Use Get Records element to get “All records” which will return all the available currencies.

Use a loop to unpack the collection, then you can get the ISO Code for each currency. You can then create pricebook entry for each currency.

  • Custom Metadata Type and Custom Setting

Of course you can also use Custom Metadata Type (CMDT) and Custom Setting (CS) in Flow! However, it works a bit different than in Process Builder. To access any CMDT or CS, you have to use a Get Records element and directly search for the specific CMDT/CS name. The easy rule is – treat CMDT as a Custom Object. You can read this article to understand more.

How To Use

Search for your CMDT as if it is a Custom Object.

You can then access all the standard and custom fields for the returned record.

Salesforce has a bunch of junction objects so it always requires some research. We connect Permission Set (PS) and User through the Permission Set Assignment (PSA) object, so you can add or remove PS for a specific user by creating or deleting the PSA record.

Data Model

How To Use

Use Get Records to get the PS you want to assign users to.

Then use Create Records to add a new PSA. If you want to assign to different User, you can also use another Get Records on the User object.

Important Fields

  • Label (PS): The LABEL of the Permission Set
  • Name (PS): The API NAME of the Permission Set
  • Assignee Id (PSA): The user who should be assigned to the PS

Back To List

Group and Group Member are very similar to PS and PSA. We connect Groups and Users through Group Members. Another important note is Public Groups and Queues are all under the Group object – you can use the Type field to differentiate.

Data Model

Important Fields

  • Name: The LABEL of the Group
  • DeveloperName: The API NAME of the Group

Back To List

The name sounds quite confusing, but the Content Document (CD) is basically the file stored in Salesforce, and Content Document Link (CDL) is the relationship between the file and the user/group/record.

Data Model

Email Message (EM) is the actual email record. If the email is related to any non-human record, you can find it in the “Relate To” field. However, if you want to find the relationship with a human record (Lead / Contact / User) , you will have to use the Email Message Relation (EMR) object. We have one use case that illustrates how to work with EM and EMR.

Data Model

Important Fields

  • ParentId (EM): The Case related to the EM
  • RelatedToId (EM): Other non-human record related to the EM
  • RelationId (EMR): The human record related to the EM
  • RelationObjectType (EMR): The object type of the above human record
  • RelationType (EMR): How is the human record related to the EM (ex. sender / recipient)

Back To List

From here we are diving into more advanced yet interesting objects. This one is Entity Definition, which is storing the information of your standard and custom OBJECTS (So an object storing object data). This can be handy if you want to provide a picklist to let user choose the object.

How To Use

These are examples of how some fields look like.

You can configure a Record Choice Set to allow your users to choose a specific object. (Notice that the maximum option is 200 – the choice set will return nothing if you have more than 200 objects qualified and you don’t fill in the Max Number. Either make it 200, or make stricter conditions)

Important Fields

  • Durable Id: The Id of the Entity Definition (Object)
  • KeyPrefix: The first 3 digits of the Id for the records of the Entity Definition (Object)
  • Label: The Name of the Entity Definition (Object)
  • DeveloperName: The API Name of the Entity Definition (Object) without suffix (ex. __c)
  • QualifiedApiName: The API Name of the Entity Definition (Object) with suffix (ex. __c)

Back To List

Another interesting one is Field Definition, which stores the information of your standard and custom FIELDS.

How To Use

These are examples of how some fields look like.

Important Fields

  • Durable Id: The Id of the Field
  • Label: The Name of the Field
  • DeveloperName: The API Name of the Field without suffix (ex. __c)
  • QualifiedApiName: The API Name of the Field with suffix (ex. __c)

Back To List

This object has only a few fields, but it is quite a complex one. The reason is the Field Permissions are not directly related to users, but through the Permission Set. There are two types of Permission Set – Owned by User or Owned by Profile. You can refer to this documentation for more information.

You can use this object to check whether a specific user has access to a specific record.

  • Tips of Learning Objects

Here are some tips of how to learn the objects more efficiently:

1. Just Google

It is very common that you will find unfamiliar objects when building Flow, but you don’t have to memorize all of them. When you see an object you don’t know, search for “[object name] object Salesforce”, and check the ones with devloper.salesforce.com url. You might find several articles on Salesforce Developers with different API, but they should all be quite similar – just find the one that is easier to read.

2. Visualize them in a Screen Flow

When I am learning a new object, I always love to use a Screen element to see how what information the fields store. It is a great way to conceptualize the objects and their fields.

Is This Helpful? Check Out Flow Use Cases Or Write Us One!
Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Neil

So, Melody, after reading your article and coming across the UserRecordAccess object for the first time, I decided to make a quick screen flow that allows a user to (1) Select a User from a picklist, and (2) enter a record ID to determine the User’s level of access. Easy peasy, right? But sadly, this is not possible because (for some reason) Salesforce will not allow you to query the Id of this object — and if you do — it fails. It IS possible to achieve this with SOQL, but NOT with a Get records element since the Id will ALWAYS be queried (selected) regardless of which route you choose (get all fields, choose fields, etc). Strange but true. But I suppose this is where you could code an invocable Apex class to return the desired result to the flow (using SOQL). Hmmm.

Gidi

Thank you, Melody, for another great article!
One thing, though. One does not need to use the Get element to query for Custom Settings of type hierarchy.
The $Setup global variable can be used for this purpose.

Additional information can be found here: https://help.salesforce.com/s/articleView?id=sf.flow_ref_resources_global_variables.htm&type=5