0
我的工作動態地需要獲取特定記錄相關的子項的項目 - 我只需要那些與子對象,其當前的記錄已關聯在頁面佈局或當前用戶配置文件列表訪問此。動態獲取所有相關列出了一個對象(對於如帳戶)
我的工作動態地需要獲取特定記錄相關的子項的項目 - 我只需要那些與子對象,其當前的記錄已關聯在頁面佈局或當前用戶配置文件列表訪問此。動態獲取所有相關列出了一個對象(對於如帳戶)
你可以使用的東西像這樣的函數來獲取相關對象後使用動態SOSL查詢
public static map<string,string> getRelatedObjects(string masterObjectName){
map<string,string> relatedObjectsMap = new map<string,string>();
list<Schema.Childrelationship> relatedObjectsList = Schema.getGlobalDescribe().get(masterObjectName).getdescribe().getChildRelationships();
for (Schema.Childrelationship relatedObject : relatedObjectsList) {
if(relatedObject.getChildSObject().getDescribe().isUpdateable()
&&
relatedObject.getChildSObject().getDescribe().getKeyPrefix()!=null
&&
!relatedObject.getChildSObject().getDescribe().isCustomSetting()
&&
relatedObject.getChildSObject().getDescribe().isCreateable()
)
relatedObjectsMap.put(relatedObject.getChildSObject().getDescribe().getName(),relatedObject.getChildSObject().getDescribe().getLabel());
}
return relatedObjectsMap;
}
請分享你有這一刻的代碼。這將是進一步討論的起點。 –