| | |
| | | /** |
| | | * @description : |
| | | * @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | * @group : |
| | | * @last modified on : 03-17-2022 |
| | | * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | **/ |
| | | global without sharing class RentalApplyController { |
| | | public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute |
| | | public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;} |
| | | public String awsToken{set;get;} |
| | | public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); |
| | |
| | | }else{ |
| | | //新建 |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | } |
| | | LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Rental_Apply__c','classic'); |
| | | layoutSections = LayoutWrapperValue.layoutSections; |
| | | layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute |
| | | List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; |
| | | Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; |
| | | requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); |
| | |
| | | }else { |
| | | rentalApplyInfo.put(fieldAPI,fieldValue); |
| | | } |
| | | // system.debug('field API'+fieldAPI); |
| | | // String fieldValue = String.valueOf(fieldAPIToTypeMap.get(fieldAPI)); |
| | | // if(String.isBlank(fieldValue) || String.isEmpty(fieldValue)){ |
| | | // continue; |
| | | // } |
| | | // Schema.DescribeFieldResult fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe(); |
| | | // Schema.DisplayType fieldDatas = fielddataType.getType(); |
| | | // system.debug('fieldValue='+fieldValue); |
| | | // if(String.valueOf(fielddatas)=='DATE'){ |
| | | // rentalApplyInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | // }else if(String.valueOf(fielddatas)=='DATETIME'){ |
| | | // String dt = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | // if(String.isNotBlank(dt)&&dt.contains('T')){ |
| | | // dt = dt.replace('T',' '); |
| | | // rentalApplyInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); |
| | | // } |
| | | // }else if(String.valueOf(fielddatas)=='Number'||String.valueOf(fielddatas)=='DOUBLE'){ |
| | | // system.debug('decimal error:'+ String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | // rentalApplyInfo.put(fieldAPI, decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | // } else if(String.valueof(fielddatas)=='BOOLEAN'){ |
| | | // rentalApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | // }else { |
| | | // rentalApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | // } |
| | | } |
| | | |
| | | //2. Save Record Process |