Questions tagged [custom-metadata]
Custom metadata types are like list custom settings, but the records are deployable and packageable metadata.
414 questions
0
votes
1
answer
65
views
Need help with using Apex to determine thresholds for a field
We have a field on the account, Market_Segment__c, that is controlled by the following piece of code:
public static string getMarketSegment(integer employeeCount){
if(employeeCount < 201)
...
-1
votes
1
answer
4k
views
What is the best way to fetch values from Custom Metadata? [closed]
Select MasterLabel, Inactive_Email__c from InactiveUsers__mdt
4
votes
1
answer
4k
views
Do Custom Metadata Queries Count Against Query or Query Row Limits?
According to the Release Notes for Custom Metadata Types:
Use SOQL queries to retrieve data from custom metadata types and their records. Unlike other Apex transactions, you can make unlimited SOQL ...
0
votes
2
answers
200
views
How to fetch custom metadata in after update trigger that was already retrieved in a LWC?
We have a LWC,mycomponent that will fetch custom metadata records, myCustomMetadataList and store them into a List variable within mycomponent. When a user clicks on the Save button on this component, ...
3
votes
1
answer
3k
views
Is it possible to evaluate a Salesforce formula in Apex?
I want to do something dynamic with an Apex method. I have some custom metadata records that contain an object and field definition. I want to inject the field value from the object into a custom ...
2
votes
1
answer
337
views
Custom metadata with Entity Definition field in Scratch Org fails to display custom object name
we have that Custom Metadata which contains a "Entity Definition" field, which is basically a lookup to an object (either standard or custom).
We pulled our source from a sandbox to a Github ...
-1
votes
3
answers
686
views
batch apex opportunity records are not updating with compare of metadata records
Opportunity records fields compareing with custom metadata record and based on values match opportunity stagename will update but it is not working and gettin error in apex job also that duplicate id ...
0
votes
1
answer
3k
views
Custom Metadata Error: Developer name already exists for given entity or has been previously used. Please choose a different name
We are trying to update custom metadata records via deployment from source org (Dev Sandbox) to target (i.e. Packaging environment - Dev Edition), these records were packaged into a managed release in ...
0
votes
0
answers
2k
views
How to map fields using custom metadata?
I have a requirement where i have two objects say, Product and Product line item(Both are custom objects). I have got a requirement where i need to map the fields in the product record to the product ...
1
vote
1
answer
788
views
Metadata.Operations.enqueueDeployment Callback not allowing Callouts
I have a scenario where I am saving custom metadata for an external API configuration. I want to deploy all the metadata, then after the deploy job is done, make a callout to the API to verify the ...
0
votes
1
answer
497
views
Custom metadata loader Mapping
I am using custom metadata loader to perform the insertion of custom metadata with 200 records. Although I have mapped the values correctly I am hitting the below mapping error.
Note: There is no ...
2
votes
1
answer
309
views
How to properly test Custom Metadata in Apex?
I'm having some trouble trying to test this methods:
public class SendingSAPServices {
public static final String SERVICE_SYNC_CLIENTE = 'SYNC_CLIENTE';
public static final String ...
0
votes
1
answer
221
views
System.UnexpectedException: Metadata.Operations.enqueueDeployment: Salesforce System Error: 1393463776-817 (799279837) (799279837)
I have some code which updates a Custom Metadata setting, something like this:
public void clearValue() {
Metadata.CustomMetadata customMetadata = createCustomMetadata();
customMetadata.values....
0
votes
2
answers
4k
views
How to get Custom Metadata Type PickList field values using LWC getPicklistValues and getObjectInfo
I'd like to access the picklist values of a field on a Custom Metadata Type from an LWC:
import { getPicklistValues } from "lightning/uiObjectInfoApi";
import { getObjectInfo } from "...
1
vote
0
answers
226
views
Can we programmatically determine Custom Metadata Type picklist values?
I would like to create a Custom Metadata Type picklist, and I want the values of the picklist to programmatically display the names of user Roles in the org. So if someone adds a new user Role, the ...
0
votes
1
answer
642
views
Cannot install custom metadata types to another org
I am performing a few REST calls in my lightning app. And the urls and tokens for REST calls are stored as custom metadata types and I query the values before making the REST call. I created a managed ...
0
votes
0
answers
68
views
Metadata migration
I migrated the custom metadata type from lower to higher environment but I am unable to view any records. Is it anywhere related to profile access issue.
0
votes
1
answer
105
views
Unmanaged Package overrides custom metadata
I have custom metadata with fields that would be only controlled by subscribers but whenever I have uploaded the new version of the package (sfdx package) in production, it overrides the existing ...
1
vote
0
answers
574
views
Case Validation rule - using custom metadata type
I need to block certain email domains in order to create Email2Case. To meet this requirement, I have created
A custom metadata type (Case_Block_Email__mdt) and a text field called Email_Domains__c ...
1
vote
1
answer
698
views
LWC: Is it possible to store part of the schema string to import in Custom Metadata
I want to store the fields that need to be imported from the schema in my LWC in Custom Metadata.
So for instance I want to make the following line dynamic:
import MY_OBJECT_ID_FIELD from '@salesforce/...
2
votes
2
answers
691
views
ERROR: The same comparison operation (LIKE or =) must be specified for all OR conditions
I'm getting a malformed query exception:
"The same comparison operation (LIKE or =) must be specified for all OR conditions".
The select statement contains something like this:
SELECT Id ...
2
votes
1
answer
365
views
Custom metadata type Field Definition Data Type evaluating incorrectly in validation rule
A custom metadata type has a Field Definition related to an Entity. The following validation rule ensures the value of this field can only be a User lookup:
AND(
FieldDefinition__c != NULL,
...
2
votes
1
answer
768
views
Retrieving audit fields of a custom metadata type object
Problem: need to know who and when created and/or last modified the custom metadata type object. This information is captured in various system fields on the object. The screenshot shows two such ...
4
votes
1
answer
321
views
Retrieving CreatedById of a custom metadata type
Is it possible to query fields like CreatedById on a custom metadata type record? Evidently not, but apparently I should be able to?!
SELECT CreatedById from MyObject__mdt
No such column '...
0
votes
1
answer
508
views
Query or extract attachment metadata in bulk
Is it possible to query or extract the metadata/document properties from attachments in bulk? Previously I have been able to get around this by using the object IDs to bulk download the files and then ...
2
votes
3
answers
1k
views
Custom Metadata Type: Metadata field type linking to a Salesforce User
I have a custom metadata type that stores configuration information related to my Salesforce package. One piece of information I'd like to store is a link to a Salesforce user.
The field controls ...
5
votes
1
answer
3k
views
Dynamically access Custom Metadata Record from formula field
I am currently using Custom Metadata Types to store offset values. The Name field will be a TimeZoneSidKey (with _ instead of /). Then I am using a formula field that will basically retrieve a value ...
4
votes
1
answer
2k
views
How to delete custom metadata type record using apex
By using CustomMetadata class we can update or create custom metadata type records as below,
Metadata.CustomMetadata customMetadata = new Metadata.CustomMetadata();
customMetadata.fullName = '...
1
vote
1
answer
532
views
Custom Meta data in Aura Design File
Currently have an aura component where the object is hard coded in the cmp and design file.
I would like to use a cmt so that the object can
<design:component>
<design:attribute name="...
0
votes
2
answers
2k
views
How to create a flow that updates region (picklist) based on inputted shipping states?
I am trying to figure out a way to dynamically update a custom picklist field called Account.[Region] based on an inputted shipping state (text field). The reason we're not considering a formula field ...
0
votes
0
answers
63
views
Can I add custom fields or values to existing metadata objects?
Our app allows users to select Lightning components to populate our legacy "widget" framework. Yes, I know we could redesign the product to use Lightning pages, but we're not doing that ...
1
vote
1
answer
339
views
Using Custom metadatype to compare which fields are modified
I'm trying to do some actions like calling a class when an only separate set of fields are modified on an object.
What I did
I'm using trigger.old and trigger.new to compare values of old and new for ...
1
vote
0
answers
26
views
Is there a way to hide Custom Settings and Metadata Types to Profiles? [duplicate]
Is there a way to hide Custom Settings and Metadata Types to Profiles?
Thank you in advance! :)
18
votes
7
answers
4k
views
Custom Metadata vs. Custom Objects in Managed Package
I worked on Managed packages for nearly 10 years now and never missed Custom Metadata Types. Not before they came and not after they were announced. I didn't come across a single great and technical ...
0
votes
1
answer
1k
views
Why is ORDER BY incorrectly sorting fields from a custom metadata type? [duplicate]
I have a SOQL query on one of my org's custom metadata types that looks like:
List<Metadata_Type__mdt> = [ SELECT String1__c, String2__c
FROM Metadata_Type__mdt
...
1
vote
1
answer
222
views
How quickly are updates to Custom Metadata Types committed?
In continuing to evaluate the best approach to storing security credentials, I have found the following Trailhead module for Secure Secret Storage: https://trailhead.salesforce.com/content/learn/...
1
vote
1
answer
959
views
Custom metadata types - subquery relationship name
Is it possible to use Custom Metadata Types in the subqueries? If yes, how?
In my case, there is a custom metadata type named Custom Actions and there is a Next_Action field in it. When I query for ...
2
votes
3
answers
13k
views
How would I deploy history tracking for the owner field using ant?
I am using visual studio code to retrieve source from the org and then deploying changes in ant using the package.xml. Is there a way to grab the history field tragging flag for the standard field "...
2
votes
1
answer
1k
views
Bulkified Flow and Custom Metadata Query
I have a straightforward autolaunched Flow (triggered by PB). It looks up some characteristics of a CampaignMember and based on that, returns a score ("fireball") value. The two subflows here write to ...
0
votes
0
answers
362
views
Custom Setting vs. Custom Object vs. Custom Metadata Type for Multiple Environment Credentials [duplicate]
I am looking to confirm the best practice of storing client / secret credentials for multiple environments for multiple external webservices within salesforce.
Below is the analysis I have done ...
0
votes
1
answer
292
views
Add custom metadata records to unlocked package [closed]
Like the question says. I'm trying to find a way to add custom metadata records to an unlocked package.
3
votes
2
answers
51k
views
How to fetch Custom Metadata Type record in apex and compare it with a string
I have a string which is holding email ids of users from my org.
Now I have few custom metadata type records which are holding email IDs of users who are inactive.
Now I need to compare the string ...
1
vote
0
answers
283
views
SOQL query with 'LIKE not giving expected results
In my org, I've set up some custom metadata on which I have all text fields which I am querying.
On my query without anything in the where condition
SELECT Label,Fields__c,Labels__c,Scheme__c from ...
1
vote
1
answer
4k
views
LWC "Record Detail Page" for Custom Metadata Type
I'm exploring a concept that involves exposing Custom Metadata Type records to business users in a read-only format in a kind of pseudo-record-detail-page in Lightning Experience. My requirements are:...
1
vote
1
answer
2k
views
No create/update access for object when importing records from CSV via Salesforce CLI
I've been testing to insert a custom metadata type record from a CSV file via Salesforce CLI. I've used below command but I've been getting the following error:
Command
sfdx force:data:bulk:upsert ...
3
votes
1
answer
2k
views
Packaged Custom Metadata Type Records Not Editable Once Deployed Even Though They Are Public
I have a managed package which has a custom metadata type. My package has default records in that custom metadata type. The custom metadata has been set to have a visibility of Public.
Also, those ...
0
votes
1
answer
767
views
How to store OAuth credentials in Salesforce Securely [closed]
I have implemented a custom auth provider by following the steps from this help guide https://help.salesforce.com/articleView?id=sso_provider_plugin_custom.htm and the setup works as expected.
Now ...
1
vote
1
answer
2k
views
Custom Metadata value in formula - access values based on field label or record data?
According to this article (https://help.salesforce.com/articleView?id=custommetadatatypes_validation_rules.htm&type=5) we can use Custom Metadata in a formula now. What I'd like to know is how ...
1
vote
1
answer
641
views
How do I get the all values of a Custom Metadate Type record into a set?
I have a custom metadata sObject - I want to retrieve all the field values into a set.
Health_Cloud_Case_Integration_Settings__mdt cmdtRecords = [SELECT Id, Field1, Field2, etc FROM ...
1
vote
1
answer
902
views
Why does my custom metadata field defintion query not work?
I'm reading the answer to this following question:
How to get a field's API name when querying a field of datatype, Metadata Relationship(Field Definition)
However, when I run the following ...