Create and Edit ListView Flow Action
This is a basic implementation of a Flow Action that allows List Views to be created using a Flow. Here’s a sample configuration:
Running this successfully will lead to a List View like this:
This project isn’t really ready for full use, for a couple of reasons:
- Need to implement Editing and Deleting. Currently an incoming Id is ignored.
- In order to enable the user to select an existing list view to modify, need to implement a Get List View Description as another action. You could then put the values in a picklist and use the selected Id as an input to this action.
The biggest problem here is that the ListView metadata is so ancient, it uses for many of the most common standard object fields, table names instead of API Names. That means that while you might think you could pass it something like Contact.ReportsToId
You actually have to set the metadata to
Note that this isn’t always the case. In the example below, you can see that OperatingHours is the same in metadata as it is as a Field Name. That probably means that OperatingHours got added later.
I haven’t located a mapping that maps Field Names like ReportsToId to their corresponding ‘table names’.
However, it wouldn’t actually be that hard to create the world’s first mapping table for this. That’s because if you take a scratch org, and then manually create a list view with a bunch of columns
, and then do a source pull, the metadata representation of that list view is downloaded into your sfdx project, like this:
This would have to be done 15 columns at a time, for each standard object. Then the mappings could be put into a big Map<String, String> in an Apex class. once someone does this one time, the whole ecosystem will have it forever.
Depending on how you want to expose the list view column selection, you might find it very useful to first ask the user to pick their object type and then get all of the field names using https://unofficialsf.com/getfieldinformation-get-fields-for-an-object/