I have two Custom Metadata Types. Content__c and Section__c. Each Section has a required Content__c record.

I can insert Content__c records using a class generated from the metadata WSDL and everything works fine.

When I try to insert Section records and specify the Content__c field and give it the value of the developer name field, it throws this error:

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Unknown SObject Namespace for Metadata Error Id: 1304496764-90552 (-768177128) faultcode=soapenv:Server faultactor=

I have created a Section__c record using the Salesforce UI and linked it to a Content__c record. I then executed a readMetadata command via the API and was returned what I expected. The particular value of the metadata relationship looks like this:

CustomMetadataValue:[apex_schema_type_info=(...soap.sforce.com/2006/04/metadata, true, false), field=MB096__Content__c, field_order_type_info=(field, value), field_type_info=(field, ...soap.sforce.com/2006/04/metadata, null, 1, 1, false), value=MB096__Test, value_type_info=(value, ...soap.sforce.com/2006/04/metadata, null, 1, 1, true)]

(Note I put ... in place of the https:// because I can't post more than 2 links).

Here is the code I am using to test this out:

MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();

MetadataService.CustomMetadata customMetadata = new MetadataService.CustomMetadata();
customMetadata.fullName = 'MB096__Section.Test';
customMetadata.label = 'My_Test';

MetadataService.CustomMetadataValue testValue = new MetadataService.CustomMetadataValue();
testValue.field = 'MB096__Has_Resource__c';
testValue.value = 'true';
MetadataService.CustomMetadataValue value2 = new MetadataService.CustomMetadataValue();
value2.field = 'MB096__Content__c';
value2.value = 'MB096__Test';
customMetadata.values = new MetadataService.CustomMetadataValue[] {
    testValue, value2
List<MetadataService.SaveResult> results =
        new MetadataService.Metadata[] { customMetadata });

This issue is fixed across all instances.

  • This issue seems to have returned - case 15971148
    – Jeff
    Mar 14 '17 at 14:23
  • And now it is fixed again.
    – Jeff
    Apr 11 '17 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.