jongpie / CustomMetadataSaver

Allows saving changes to custom metadata records via Apex and Flow
MIT License
39 stars 5 forks source link

Picklist fields (and maybe others?) cause issue when deploying Metadata records #4

Closed adwhite75 closed 3 years ago

adwhite75 commented 3 years ago

When creating a CMT record with a pickvlist value (one passed from a Flow screen component) the deployment fails:

FLOWCUSTOMMETADATACREATOR (APEX): Add_CMT_record Inputs: customMetadataTypeName = Finance_Mappings__mdt developerName = Mapping1 masterLabel = Mapping1 Outputs: Finance_Mappings__mdt (No ID)

ASSIGNMENT: Set_Details_of_CMT_Record {!Add_CMT_record.Discountc} Equals {!Discount_Percentage} {!Add_CMT_record.Account_Typec} Equals {!picklistAccountType} Result {!Add_CMT_record.Discount__c} = "0.55" {!Add_CMT_record.Account_Type__c} = "Prospect"

ASSIGNMENT: Add_to_CMT_Collection {!collectionOfCMTRecordsToMake} Add {!Add_CMT_record} Result {!collectionOfCMTRecordsToMake} = "[Finance_Mappings__mdt (No ID)]"

CUSTOMMETADATASAVER (APEX): Deploy_CMT_Records Inputs: customMetadataRecordsLists = {!collectionOfCMTRecordsToMake} ([Finance_Mappings__mdt (No ID)]) Error Occurred: An Apex error occurred: System.TypeException: Error deploying metadata of type CustomMetadata and fullName Finance_Mappings.Mapping1. Error message: Assignment of unsupported type to field name 'value'

jongpie commented 3 years ago

@adwhite75 thanks for reporting this. It looks like this is just an issue with picklist fields on custom metadata types - I created a CMDT record that had 1 field for each possible type (text, number, picklist, etc.), and only the picklist field seems to cause this issue.

I'll merge a fix for this later today - let me know if you run into any other issues!