/*
|
* Author: Zhang,Heyang
|
* Created Date: 08/07/2023
|
* Purpose: get page layout and record data
|
* Test Class: LexNewAndEditRepairOrderPIPLTest
|
* */
|
public with sharing class LexNewAndEditRepairOrderPIPLController {
|
@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 Applicanter__r.lastName,Applicanter__r.AWS_Data_Id__c,Receiver__r.lastName,Receiver__r.AWS_Data_Id__c, ';
|
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;
|
}
|
}
|