A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged


An SObject by itself can be cast to EmailTemplate, however, Map cannot, that happens, because you may have not only EmailTemplate as values in Map, but also other SObjects. Example: Map<String, SObject> sobjectMap = new Map<String, SObject>(); sobjectMap.put('red', new Account(Name = '123')); sobjectMap.put('green', new Contact(LastName = '123')...


You can easily parse your String into Map and then serialize Map itself. Here is an example how to do it: String toMap = 'Profile:[UID=, crmId=0000o00002XXXXxXXX, email=top@top.com, firstname=null, lastname=test]'; Map<String, String> ans = new Map<String, String>(); String actualValues = toMap.substringAfter(':'); actualValues = actualValues....

Only top voted, non community-wiki answers of a minimum length are eligible