| | |
| | | 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()); |
| | | |
| | | System.debug('layout 8' + layout_name); |
| | | |
| | | List<Metadata.LayoutSection> temp = GetLayoutSections(objectType,layout_name); |
| | | List<Metadata.LayoutSection> layoutSectionList = new List<Metadata.LayoutSection>(); |
| | | for(Metadata.LayoutSection section : temp){ |
| | |
| | | } |
| | | |
| | | /*[{ |
| | | "attributes": { |
| | | "attributes": { |
| | | "type": "Layout", |
| | | "url": "/services/data/v53.0/tooling/sobjects/Layout/00h10000009iAb5AAE" |
| | | }, |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | System.debug('mso 60' + mso); |
| | | |
| | | return 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]; |
| | | if(lso.size()==0){ |
| | |
| | | return null; |
| | | }else{ |
| | | Map<string,object> mso = (Map<string,object>)JSON.deserializeUntyped(s); |
| | | System.debug('mso 122' + mso); |
| | | |
| | | if(integer.valueOf(mso.get('size')) > 0){ |
| | | List<object> records = ((List<object>)mso.get('records')); |
| | |
| | | List<String> componentNameList = new List<String>{object_name+'-'+layout_name}; |
| | | //通过Metadata.Operations.retrieve获取metadata |
| | | //Metadata.Layout -> Metadata.LayoutSection -> Metadata.LayoutColumn objects -> Metadata.LayoutItem objects |
| | | System.debug('componentNameList 171: ' + componentNameList); |
| | | List<Metadata.Metadata> componentList = Metadata.Operations.retrieve(Metadata.MetadataType.Layout, componentNameList); |
| | | System.debug('componentList 173 ' + componentList); |
| | | if(componentList?.size() > 0){ |
| | | Metadata.Layout layout = (Metadata.Layout) componentList.get(0); |
| | | List<Metadata.LayoutSection> layoutSectionList = layout.layoutSections; |