/*  * Author: Zhang,Heyang  * Created Date: 2023/08/07  * Purpose: get page layout and record data * Test Class: LexNewAndEditOnCallPIPLControllerTest  *  * */ public with sharing class LexNewAndEditOnCallPIPLController { @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 Oncall_Equipment__r.Name, '; 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; } }