Responses

  1. Hi I tried using your code, but get the following error: 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.

    This has to do with Developer Name.
    This is the code I have in Execute Anonymous:

    mdtImport.insertMetadata('Netsuite_Country_State__mdt', '[{"DeveloperName":"United_States_AA","MasterLabel":"United_States_AA","To_Country":"United States","From_State":"AA","To_State":"Armed Forces Americas","Code":"AA"}]');

    Can you please help.
    DeveloperName and MasterLabel are the standard fields of the Metadata Object

  2. Line number 10 : for(JSONCsvTemplate.mdtRecords item : csv.data.mdtRecordsList)

    should be changed to
    for(mdtRecords item : csv.data.mdtRecordsList)
    Thank you.

Popular Salesforce Blogs