function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeannine RobitailleJeannine Robitaille 

Is it possible to not just reference but also update custom metadata values using Flow?

Ashish Singh SFDCAshish Singh SFDC

Hi Jeannine,

No, it's not possible to update custom metadata from the flow. Instead, you should go with List Custom Setting that'll be way better.

Updating Custom Metadata is similar to deploying components. If you want to update custom Metadata very frequently then go with List Custom Setting.

Go through this very well-explained article Create and Update Custom Metadata using Apex (https://www.sfdcpanther.com/create-update-custom-metadata-using-apex/) to understand how Custom Metadata works.

If you still want to go with custom Metadata then develop an apex class as shown in the article and call apex from the flow.

OR

You can also visit https://unofficialsf.com/ (https://unofficialsf.com/save-and-update-custom-metadata-records-using-flow/amp/) as they are offering a package that can update custom metadata through flow.

Thanks,

Ashish Singh.

Jeannine RobitailleJeannine Robitaille
OK thanks for steering me on the right path. One more related question. Is there an issue with pulling the Custom Setting SetUpOwnerID using flow because every time I compare it to the $User.ID, it never matches? Yet a display of those values indicate that it should match. Regards, Jeannine Alliance Security & Communications Project Manager Direct: 613-507-4931
Ashish Singh SFDCAshish Singh SFDC
Hi Jeannine,

Basically, there are two types of custom settings:

1. List Custom Setting=> It is used when we have static data that everyone in the Org can use regardless of any herieracy. For example a checkbox you simply want to use to enable and disable the trigger. However this option is not available by default in the new org. You need to follow below step to enable this option:
Go to Setup | Data or Search “Schema Settings” in Quick Find | Click Schema Settings | Enable “Manage List Custom Settings Type”.

2. Hierarchy Custom Setting =>
 It uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. Which means you specifically have to specify for which profile or user what value you want to set. For example, a Senior Manager can take 3 leaves in a Month and a Manager can take only 2 leaves.

You need to identify which one fits right into your solution. If List Custom Setting, then you don't need to worry about SetUpOwnerID and if Hierarchy Custom Setting, then you need to create record specifying the User or profile and then you can evaluate in the flow. BUt this step is optional if you dont want to evaluate, you don't need to create record as well.

Here is the Custom Setting Salesforce Documentation (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_customsettings.htm)

Thanks,
Ashish Singh.
Jeannine RobitailleJeannine Robitaille
Thank you Ashish. I was able to resolve my issue. I had to use custom setting hierarchy with Profile instead of User. For some reasons, matching the filter SetupOwner with User created custom setting ($User.id) would match. Using Profile created custom setting ($User.ProfileId) matches with no issues. Not sure if this is a bug in Salesforce. Regards, Jeannine Alliance Security & Communications Project Manager Direct: 613-507-4931