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
Chaudhary AdityaChaudhary Aditya 

Unable to complete Trailhead Challenge

Hi all, 
I am trying to complete below challenge and getting an error. I have copied all details(Challange Link, Code and Error).  

Appreciate your help!


CHALLENGE NAME

https://trailhead.salesforce.com/content/learn/modules/apex_metadata_api/apex_metadata_api_tools?trailmix_creator_id=strailhead&trailmix_slug=prepare-for-your-salesforce-platform-developer-ii-credential

CODE
public class MetadataExample {
    
    public  Metadata.CustomMetadata customMetadata{get;set;}
    public void updateMetadata(){
        
        customMetadata  = new Metadata.CustomMetadata();
        customMetadata.fullName  = 
            'MyNamespace__MyMetadataTypeName.MyMetadataRecordName';
        
        Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
        customField.field = 'customField__c ';
        customField.value = 'New Value';
        
        customMetaData.values.add(customField);
        
        Metadata.DeployContainer deployContainer = new Metadata.DeployContainer();
        deployContainer.addMetadata(customMetaData);
        Id asyncResultId  = Metadata.Operations.enqueueDeployment(deployContainer, null);
    }
}

ERROR





 
AbhinavAbhinav (Salesforce Developers) 
Hi Aditya,

Please note that Questions about how to pass Trailhead challenges are not on topic, because these challenges are intended to be independent demonstrations of your abilities.Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)can provide assistance for situations where Trailhead does not appear to be functioning correctly. You can reach out to them if this is the case.

Thanks!
Chaudhary AdityaChaudhary Aditya
Hi Abhinav, 

May be I worded it incorrect.. I am not looking for a solution. If you look at the problem - the error message is very obvious. 

I am trying to figure out if it could be a Trailhead issue and if others have faced the issue. 

 
ash rodash rod
If you are planning to buy a water purifier for your home, then the first thing you need to know is the quality of the water supply in the house. Check this https://bestwaterpurifierreviews.in for more details.
Suraj Tripathi 47Suraj Tripathi 47
Hi,
Please share your error Here.
maybe it should not be String and here you use this as a String Value :
customField.field = 'customField__c ';
make sure the value dataType and put that type value only.

if you have any query please comment.
---------------
If you find your Solution then mark this as the best answer to close this question. 

Thank you!
Regards,
Suraj Tripathi