2

This Is the Error I am getting {"status":500,"body":{"message":"An internal server error has occurred\nError ID: 1020912311-169956 (-524102090)"},"headers":{}}

I have tried adding the namespace while record creation in various ways but it still doesn't work properly. Any Help would be appreciated.

String recordName = 'spcon__HQ_Azure_Active_Directory_Auth.'+mdtRecordFields.recordName;
        String label = mdtRecordFields.label;
        Map<String,Object> metaDataFieldsMap = new Map<String,Object>();
        metaDataFieldsMap.put('Azure_Grant_Type__c',mdtRecordFields.azureGrantType);
        metaDataFieldsMap.put('Azure_Scope__c',mdtRecordFields.azureScope);
        metaDataFieldsMap.put('Client_Id__c',mdtRecordFields.clientId);
        metaDataFieldsMap.put('Client_Secret__c',mdtRecordFields.clientSecret);
        metaDataFieldsMap.put('Drive_Id__c',mdtRecordFields.driveId);
        metaDataFieldsMap.put('SharePoint_Site_Id__c',mdtRecordFields.sharePointSiteId);
        metaDataFieldsMap.put('Tenant_Id__c',mdtRecordFields.tenantId);
        metaDataFieldsMap.put('is_Active__c',mdtRecordFields.isActive);

1 Answer 1

2

I have found it necessary to include the namespace prefix on fields and types (presumably spcon__ here?) and also to include the __mdt suffix on the type name prefix for the record fullname so:

String recordName = 'spcon__HQ_Azure_Active_Directory_Auth__mdt.'
    + mdtRecordFields.recordName;

Using String.valueOf on the SObjectType or SObjectField tokens does the right thing for you, so although it's a bit verbose I recommend for the record type string:

String.valueOf(spcon__HQ_Azure_Active_Directory_Auth__mdt.SObjectType)

and for the field strings:

String.valueOf(spcon__HQ_Azure_Active_Directory_Auth__mdt.Azure_Grant_Type__c)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .