I created a Text Area field in Custom Metadata and I'm trying to SOQL that field but I get NULL.

List<CustomMtd__mdt> customMtdList = [SELECT textAreaField__c FROM CustomMtd__mdt LIMIT 1];
String str = customMtdList[0].textAreaField__c;  //NULL
  • did you check the customMtdList[0].textAreaField__c have a value ? As i can check, i can get the values. – sanket kumar Sep 16 '18 at 6:57
  • 1
    You're running a LIMIT 1 query without a filter. Are you sure it's returning the record you think it's returning? – David Reed Sep 16 '18 at 12:50

Use the Apex class as Without Sharing and it worked for me.

public without sharing class noSharing {

// Code here

  • 2
    Welcome to SFSE! Please take the tour and read How to Answer. I don't think that this answers the question being asked. Even if it did, though, this answer would be improved if you were to explain why your solution works. The purpose in doing so is to "teach a person to fish", to impart an understanding of how something works so they (and others) can apply the solution to similar (but different) problems without needing to ask for help (or to be able to ask for less help). – Derek F Sep 26 '18 at 14:57

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.