| | |
| | | public without sharing class MetaDataUtility { |
| | | |
| | | public static List<Metadata.LayoutSection> GetRecordTypePageLayout(string record_type_id,string objectType){ |
| | | |
| | | Map<string,object> mso = null; |
| | | System.debug('rerord 6' + record_type_id + ':' + objectType); |
| | | string layout_name = GetRecordTypePageLayoutName(record_type_id,objectType,UserInfo.getProfileId()); |
| | |
| | | if(c.layoutItems != null && c.layoutItems.size() > 0 ){ |
| | | a = true; |
| | | } |
| | | |
| | | } |
| | | if(a){ |
| | | layoutSectionList.add(section); |
| | |
| | | */ |
| | | |
| | | public static string GetTableOrEnumId(string objectType){ |
| | | |
| | | Map<string,object> mso = null; |
| | | string resp = null; |
| | | string table_or_enum_id = objectType; |
| | |
| | | string resp = null; |
| | | Map<string,object> mso = null; |
| | | |
| | | |
| | | string table_or_enum_id = GetTableOrEnumId(objectType); |
| | | |
| | | if(string.isBlank(table_or_enum_id)){ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public static string GetRecordTypePageLayoutName(string record_type_id,string objectType, string profile_id){ |
| | | System.debug('objectType 92' + objectType); |
| | | System.debug('profile 93 ' + profile_id); |
| | | |
| | | if(!string.isBlank(objectType)){ |
| | | List<sobject> lso = [SELECT Id, Name, DeveloperName, SobjectType, IsActive, Description, BusinessProcessId FROM RecordType where SobjectType = :objectType]; |
| | | List<sobject> lso = [ |
| | | SELECT Id, Name, DeveloperName, SobjectType, IsActive, Description, BusinessProcessId |
| | | FROM RecordType |
| | | WHERE SobjectType = :objectType |
| | | ]; |
| | | if(lso.size()==0){ |
| | | return string.valueOf(((Map<string,object>)(GetAllPageLayout(objectType)[0])).get('Name')); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public static string ToolingQuery(string query){ |
| | | |
| | | system.debug('query='+query); |
| | | String baseURL = 'callout:SF_Rest_API/services/data/v41.0/tooling/query?q='+ query.replace(' ', '+'); |
| | | HttpResponse resp = null; |
| | |
| | | system.debug('status is not ok,error:'+resp.getBody()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | public static List<Metadata.LayoutSection> GetLayoutSections(string object_name, string layout_name){ |
| | |
| | | Metadata.Layout layout = (Metadata.Layout) componentList.get(0); |
| | | List<Metadata.LayoutSection> layoutSectionList = layout.layoutSections; |
| | | return layoutSectionList; |
| | | } |
| | | else{ |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | } |