Hi! 🙂
Recently, I had to go through the pain of manually creating a lot of Custom Metadata type records. And that pushed me to create this flow screen so no one has to go through that pain. 😂
Note: For those, who are familiar with CLI, you can use CLI command to create/update Custom Metadata type records via a CSV. However, there is one issue which at least prevented me from using it.
So, let’s just quickly see it in action, shall we?
You can find the link Package(unmanaged) link and source code here: https://github.com/forcePanda/Flow-Repo/tree/master/Screen%20Components/CSV%20to%20Custom%20Metadata%20Records%20Component
Considerations for Preparing the CSV
- Make sure NOT to put any blank value in the last column of the csv.
- All CSV cells MUST be of Text type, in other words, ‘format the cells’ as Text type.
- Format for Date and Date time values: YYYY-MM-DD HH:MM:SS
- Use the API name(s) of the field of the CMDT in the CSV column header.
NOTE: Make sure to follow the notes for preparing your CSV otherwise the component will not work as expected.
Hope you find this helpful! I’ll catch you in the next one! ✌
Thank you for being an awesome reader! Subscribe to ForcePanda for receiving all the latest updates straight to your inbox. 🙂
Pingback: Create Custom Metadata Records from Flow & a CSV File – UnofficialSF
Pingback: Flow Community Development Overview “Flowcast” – Feb. 2021 – UnofficialSF
Pingback: Flow Community Development Overview “Flowcast” – Feb. 2021 – UnofficialSF
Pingback: Create and Manage Custom Metadata Types using Salesforce CLI | forcePanda
Hello Narender,
Thank you for your works and efforts
I’m struggling to update CMDT records using your component in Flow. I was using DeveloperName in the CSV fiel to to map records but couldn’t make it work.
The component showed error and asked me to check the API name again
Can you explain a little bit more how to update records?
Toan
LikeLike
What is the exact error that you’re getting?
LikeLike
“DeveloperName. Please double check the API name of the field.Check console log for more info”
this is the exact error showed up in my screen
LikeLike
Hi Narender,
Initially the csv file was saved in UTF-8 encoding, I changed the output file to normal csv and it works now
LikeLike
Oh, amazing! Glad you resolved it. 🙂
LikeLike
Hi Narender,
Thanks for the great effort i used your solution now a coupe of times but now i have a csv which should have UTF-8 encoding. Is there a way to make this solution also compatible with the UTF-8 encoding format?
LikeLike
What issues are you facing with UTF-8 encoded CSV?
LikeLike
Hello – I love the idea of this component. I’m struggling to get it functioning properly though.
This is the error message I’m receiving when attempting to run the flow via utility bar: “Invalid double: hyd panelCheck console log for more info.”
I am using a standard csv file, not UTF-8 that others noted above. I can’t figure out where the configuration error is.
To help aid in troubleshooting:
I’ve confirmed the contentdocumentId and cmdt api names are accurate. I was initially also getting a couple errors with respect to column names that I resolved as well. I’ve ensured that DeveloperName and MasterLabel are populated and unique.
Thank you for any support! Really excited about getting this put together correctly!
LikeLike
I think one of your cells in the CSV has a value “hyd panel”. That column I believe is supposed to be of Number (Decimal) type.
LikeLike
Also, please read the CSV considerations mentioned in the post again and make sure the CSV checks out all the points.
LikeLike
Hello again – thanks for the fast reply. I have gotten past that error – so thank you for giving me a specific cell to look at it. The mistake was that there were commas in that cell of text.
After removing all commas and reaffirming the end column didn’t have any blank values, CMDT API Names of fields were column headers and all fields were ‘text’ (no dates in my csv), I received this error:
Salesforce System Error: 1408020708-333373 (1188083556) (1188083556)Check console log for more info.
Probably obvious to others, but just want to note if anyone else runs into this; I resolved the above error by limiting my record creation to 100 records, and was successful.
Thank you so much! This is going to save a ton of time for our team!
LikeLike
Awesome!
Glad to know you resolved it. 🙂
LikeLike
Hi Narender.
I was using this screen component for uploading custom metadata records and I got issue when my csv file contain values with comma. I also tried by wrapping values into double quotes but the issue isn’t resolved.
If I was saved the file as CSV (UTF -8 ) then screen component gives error ‘DeveloperName. Please double check the API name of the field.Check console log for more info’.
Please reply it asap.
Thanks
Prafull Jain
LikeLike
Looks like there is some issue with the encoding of CSV. Or there are some hidden characters.
That’s why the DeveloperName is appearing(and being read) as ‘DeveloperName.
LikeLike
Hey
This error ‘DeveloperName will not occur when i saved the file as CSV only. It only occurs when I was saved the file as CSV (UTF-8).
My issue was that in CSV file, I have values that contain comma like Prafull, Jain. that will inserted as Jain.” in custom metadata records.
LikeLike
Hi there,
I am getting the below error – can you please help me?
List index out of bounds: 6Check console log for more info.
Thanks
LikeLike
Hey Jan,
Can you please make sure your CSV checks all the points under “Considerations” section?
LikeLike
I set the content document id and run the flow but its empty. There is no job id generated. What can be wrong?
LikeLike
What does it show on the screen?
LikeLike
Ok, I feel like I’m missing something obvious here, but I’m new to unmanaged packages.
I’ve installed the package to a sandbox org and I cannot find the flow anywhere. I’ve verified that the package is installed (v1.1), and found the other package components sprinkled around in there like the Dummy CMDT Type. But there’s no screen flow to be found. What am I missing?
LikeLike
I’m not sure if I packaged the flow too. 😄
It should be easy enough to add the component to the screen flow and configure it.
Feel free to reach out if you face any issues setting it up.
LikeLike
As someone else wrote – I set the content document id + Metadata API name and run the flow but its empty. There is no job id generated and so sign it work. Also had a developer trying to make it work and still nothing.
LikeLike
Are you running the flow in Debug mode?
LikeLike
I have this problem as well and I can’t reply with a screenshot.
Deploy Request Job ID: (not literally, just doesn’t show anything)
Status: (again, doesn’t actually say it, just is empty)
I’ve waited a long time and still no progress
LikeLike
Hi,
Are you running the flow in debug/run mode? If yes, it won’t work.
Put the flow in the lightning app/record page and try again.
LikeLike
This tool is great and is functioning well. The only issue I’m experiencing right now is when I import some of my values they get extra quotations added to them. For example:
*Imported value: 3/4″ Alum-mill V#2
*Resulting CMDT record: “3/4″” Alum-mill V#2″
I’ve ensured to format all as text, I’ve trimmed the cells, and do not have any blank cells in the last row. My tests show the presence of the wanted inch (“) symbol is what causes the issue, as if I remove that character then the issue goes away. However, I need those values. Do you know of any work arounds for this?
LikeLike
Honestly, I’m not sure. It probably is related to encoding scheme or how these values are being read in Apex. Other than manually updating records, I don’t have any other solution for you at the moment, sorry. 😦
LikeLike
Thanks for the quick reply! All in all, your tool still saves a lot of time!
LikeLike
In case someone runs into something similar, I paired Narender’s awesome tool here with a tool created by Jonathan Gillespie to create and update custom metadata records from within flow. These 2 tools pair together very well. See more here: https://unofficialsf.com/save-and-update-custom-metadata-records-using-flow/amp/
LikeLike
Ahh, yes. A good combo indeed!
LikeLike
Great tool! Have managed to insert new records, but struggling to update existing. Getting the error “problem”: “DummyCMDTType__mdt: could not find fields: Id”
My CSV is like this, where Id is of the inserted record:
Id,MasterLabel,TextField__c
m0U5r000000L5ouEAC,New Test Label,Test 1
Any ideas what I’m missing or doing wrong?
LikeLike
This could be a huge time saver for me but I’m getting the following error.
Custom Metadata Record Name: The Competency Item API Name can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores
My API Name is Competency_Item__mdt. Alos tried CompetencyItem__mdt
Any ideas what might be wrong. I have the exact API name in the flow.
Thanks.
LikeLike
Can you share screenshots of your set up?
LikeLike
Here’s the error. I am doing this in a sandbox. Screenshot doesn’t seem to be posting so…
FSC_CSVToCMDTRecords Setup:
Content Document ID: {!Single_Content_Doc_Id} which I used a first screen to upload the file and assign the content doc id to that variable.
Customer Metadata API Name: Compentency_Item__mdt
Error Message.
“success”: false,
“problemType”: “Error”,
“problem”: “Custom Metadata Record Name: The Competency Item API Name can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.”,
“lineNumber”: null,
“id”: null,
“fullName”: “CompetencyItem__mdt.1”,
“fileName”: “customMetadata/CompetencyItem__mdt.1.md”,
“deleted”: false,
“createdDate”: “2023-01-08T21:07:20.075Z”,
“created”: false,
“componentType”: “CustomMetadata”,
“columnNumber”: null,
“changed”: false
},
{
“success”: false,
“problemType”: “Error”,
“problem”: “Custom Metadata Record Name: The Competency Item API Name can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.”,
“lineNumber”: null,
“id”: null,
“fullName”: “CompetencyItem__mdt.2”,
“fileName”: “customMetadata/CompetencyItem__mdt.2.md”,
“deleted”: false,
“createdDate”: “2023-01-08T21:07:20.116Z”,
“created”: false,
“componentType”: “CustomMetadata”,
“columnNumber”: null,
“changed”: false
},
{
Content Document ID: {!Single_Content_Doc_Id} which I used a first screen to upload the file and assign the content doc id to that variable.
Customer Metadata API Name: Compentency_Item__mdt
LikeLike
Can you put the screenshot on g drive or something?
Basically, I want to check if the CMDT api name matches what you’ve input in the flow config of the component.
LikeLike
I can’t see the files. Can you upload them o cloud and share the links?
LikeLike
Metadata Screenshot: https://dwservices-my.sharepoint.com/:i:/g/personal/kblank_deepwellservices_com/ERWCarvejJxMqt4JKWr1VpYBxmeseWgwprlS4CNkOdZDIQ?e=iYwzeP
Flow Screen: https://dwservices-my.sharepoint.com/:i:/g/personal/kblank_deepwellservices_com/Ed_tgH20B9pCqWG1WaPZcSsB1spn-5GqVkEp1ZLIuMo2Bg?e=rnAfVf
LikeLike
The set up looks fine. Can you confirm you’ve both CMDT and the Flow in the sandbox?
Also, check the API names of the CDMT records in your CSV.
LikeLike
Figured it out. My mistake for sure but I’ll post so no one else does the same thing. I had the Label as sequential number like 1, 2, 3. When I filled out the Developer Name column, I forgot to add an X to the so it is X1, X2… Since API’s can’t start with numbers.
LikeLike
Ah, nice! Thanks for sharing.
LikeLike
Hello,
When I’m running the component in the flow, the status keeps showing ‘deployment_in_progress’.
In the console it shows the following:
Subscribed to channel /event/MetadataDeploymentResult__e
FSC_CSVToCMDTRecords.js:94 Unsubscribed from channel /event/MetadataDeploymentResult__e
Do you have any idea why it’s failing?
LikeLike
Are you running it in debug mode?
LikeLike
No, it’s on the homepage. I do get a JobId.
I used it before and normally you get a lot more info when it’s working. But I get no information.
LikeLike
Apparently now my data was uploaded, but I did not get any confirmation message. Thanks for the help anyway!
LikeLiked by 1 person