/*
|
* 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<String, object> data = new Map<String, object>();
|
ResponseBodyLWC rbl = LexNewAndEditBasePIPLController.initData(rid, recordTypeId, sobjectType);
|
if(rbl.status == 'Success'){
|
data = (Map<String,Object>)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<String> objectFields = new List<String>(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;
|
}
|
}
|