public with sharing class PeEmailAlertController { public PersonalEvaluation__c pe; public String peId { get; set; } public PersonalEvaluation__c getPe() { Schema.DescribeSobjectResult s = PersonalEvaluation__c.sObjectType.getDescribe(); Map fieldMap = s.fields.getMap(); String sql = 'select '; String fields = ''; for (String field : fieldMap.keySet()) { if (fields.length() > 0) { fields += ', '; } fields += field; } sql += fields; sql += ', Owner.Alias, CreatedBy.Alias'; sql += ' from PersonalEvaluation__c where Id = \'' + peId + '\''; PersonalEvaluation__c Obj = Database.query(sql); /* String docId = Obj.DocumentImgId__c; String orgId = UserInfo.getOrganizationId(); Obj.Graph1__c = 'https://' + URL.getSalesforceBaseUrl().getHost() + '/servlet/servlet.ImageServer?id=' + docId + '&oid=' + orgId; */ return Obj; } }