UNKNOWN_EXCEPTION Using System.debug in Anonymous Apex on Custom Metadata Types object

Issue #1157 resolved
Shmuel Sochet created an issue

When I put this line of code System.debug([customObjectName]__mdt.fields); in the Anonymous Apex window I get a pop-up with this error...

UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 735232009-364516 (-710365276)


Comments (5)

  1. Scott Wells repo owner

    That error originates on the server and is called a GACK. It's basically an internal server error. My guess is that if your take that same anonymous Apex to Developer Console you'll see the same GACK. Do you mind doing that to determine whether or not this is an IC issue or a Salesforce issue? That way we'll know where to focus additional effort.

  2. Shmuel Sochet reporter

    Wow 2 minutes after I posted, you comment, that's incredible. This is what makes you as well as Illuminated Cloud so amazing. Thank you.

    You are correct, it's a GACK. Thank you for bringing this to my attention in the future I'll check the Developer Console first.

  3. Scott Wells repo owner

    Hah! My pleasure. The benefits of a completely connected world, I guess. For what it's worth on this one, I think it's just that you can't toString() or JSON-serialize some of these internal metadata concepts, evidently including the set of fields on a custom metadata type. Normally you get a nice error instead of a GACK. You might try logging the field map instead and see if that provides what you need.

  4. Shmuel Sochet reporter

    Interesting about the JSON-serialize. Yes Schema.SObjectType.[customObjectName]__mdt.fields.getMap() worked, thank you very much. ([customObjectName]__mdt.fields.getMap() did not work though it at least failed nicely.)

  5. Log in to comment