/* * Author: Zhang,Heyang * Created Date: 2023/08/07 * Purpose: get page layout and record data * Test Class: LexNewAndEditAddressPIPLControllerTest * * */ public with sharing class LexNewAndEditAddressPIPLController { @AuraEnabled public static ResponseBodyLWC initData(Id rid, String recordTypeId, String sobjectType) { Map data = new Map(); ResponseBodyLWC rbl = LexNewAndEditBasePIPLController.initData(rid, recordTypeId, sobjectType); if(rbl.status == 'Success'){ data = (Map)rbl.entity; data.put('staticResourceContact', Json.serialize(PIHelper.getPIIntegrationInfo('Contact'))); if(String.isNotBlank(rid)){ String sql = 'SELECT City__r.Name,Contacts__r.Name,Contacts__r.AWS_Data_Id__c, '; DescribeSObjectResult objectType = rid.getSobjectType().getDescribe(); List objectFields = new List(objectType.fields.getMap().keySet()); sql += String.join(objectFields, ',') +' from '+sobjectType+' where id =\''+rid+'\' limit 1'; System.debug('sql: ' + sql); Sobject leadData = Database.query(sql); data.put('data',leadData); } rbl.entity = data; } return rbl; } @AuraEnabled public static Map getContactByAWSId(String awsId){ Map resultMap = new Map(); Contact ContactInfo = new Contact(); ContactInfo = [SELECT Id,Name,Account.Name,Phone,Email,MobilePhone FROM Contact WHERE AWS_Data_Id__c =:awsId LIMIT 1]; resultMap.put('ContactInfo', ContactInfo); return resultMap; } }