1

I'm working on a flow in which the current object where the flow is being launched from (for example, a list view of a certain object), becomes the target object in a Get Records / Update records element.

I have the same fields in different objects which I need to get/update, however what I don't know how to do is set the object dynamically:

enter image description here

Here I have the object list but I can't choose a formula field from where I assign the object dynamically based on other variables. Can this be done?

Another option I've thought about is having decision elements before the "Get records" / "Update records" elements, and depending from which object the flow was launched, then the decision element would only execute the branch to update / get records from that object. In this last case, can I know from which object a flow has been launched from? (In my case the flow is not launched from a record page, but from a list view, so I can't use the global variable "{!$Flow.CurrentRecord}" or "recordId" as input).

Thanks!

1 Answer 1

0

No, you cannot set that dynamically. It must be selected using the drop down option provided. Same thing with Invocable Dynamic Apex.

Yes you can do the 2nd option, if you want, but it will require a few steps. You need to use the Entity Definition and Durable Id to get the object. The first 3 characters of each object identifies what it is so using Apex you can do this. This is an acceptable method of getting what the object is.

You might be able to use Flow but last I checked maybe 18 months ago, even though Flow could read 1 of the objects you could not pass the results back which were needed for next step, so had to use Apex for that part.

4
  • Hello @ddeve, thanks! Regarding your answer on the second option, "The first 3 characters of each object identifies what it is" are you referring to the first 3 characters of a record Id? In my case, I don't have a recordId because the flow is launched from a list view, not from a record page. So for example, the flow could be launched from a "Contacts" list view. Is there a way I can identify that flow interview with the Contacts object? Thanks!
    – bonzi
    Aug 16, 2021 at 15:32
  • 1
    The same flow can be launched from different list views? If you know them in advance you can't just pass a text value into an input variable with the object name to avoid some of this? @bonzi
    – ddeve
    Aug 16, 2021 at 20:13
  • I think that could be a great idea! So you're saying to add a text value as a parameter in the Flow URL that the list view button goes to, right? For example, adding "&object=Contact" at the end of the URL, to pass it into the flow? Thanks!
    – bonzi
    Aug 16, 2021 at 20:28
  • 1
    Yes if you are using a URL for this. In general for Flows I try to have 1 or more "entrypoint" variables so a flow can be reused for multiple things. That variable indicates where/how the flow started. So in your case you want to add the objecttype and/or other items to assist in further processing. i.e. ContactUpdate, ContactCreate, ContactListView, etc.
    – ddeve
    Aug 17, 2021 at 0:30

You must log in to answer this question.

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