public with sharing class SmarmEmailAlertController { public SMARM__c smarm; public String smarmId { get; set; } public SMARM__c getSmarm() { Schema.DescribeSobjectResult s = SMARM__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, Review_Practitioner__r.Alias, Review_Target__r.Alias'; sql += ' from SMARM__c where Id = \'' + smarmId + '\''; SMARM__c Obj = ControllerUtil.getSmarmById(sql)[0]; /* String orgId = UserInfo.getOrganizationId(); for (Integer i = 1; i <= Integer.valueOf(System.Label.SmarmClipNum); i++) { String docApi = 'Doc' + i + '__c'; if (fieldMap.get(docApi) != null && Obj.get(docApi) != null) { Obj.put('Image' + i + '__c', 'https://' + URL.getSalesforceBaseUrl().getHost() + '/servlet/servlet.ImageServer?id=' + Obj.get(docApi) + '&oid=' + orgId); } } */ return Obj; } }