You need to sign in to do that
Don't have an account?

How to traverse Inner query
Is there any way to get Application_Id__c(in red )???Please help me out.
Code:
**********************************************
Public string serviceOffering{get;set;}
public Map<id,id> seviceModApp_Map {get;set;}
Quote__c q=[select id,Opportunity__r.Services_Offering__c,Solution_Site_1__c,Solution_Site_2__c,Solution_Site_3__c
from Quote__c where id=:id];
serviceOffering=q.Opportunity__r.Services_Offering__c;
List<String> qte = new List<String>();
qte.add(q.Solution_Site_1__c);
qte.add(q.Solution_Site_2__c);
qte.add(q.Solution_Site_3__c);
seviceModApp_Map = new Map<id,id>();
for(Service_Model__c servMod:[select id,name,(select id,Application_ID__c from Service_Model_Applications__r where
Application_ID__c IN(select Application_Id__c from Site_Application__c where Site_CX__r.Name__c IN:qte))
from Service_Model__c where Service_ID__r.Name__c=:serviceOffering and Is_Default__c=:True]){
for(Service_Model_Application__c sma:servMod.Service_Model_Applications__r){
seviceModApp_Map.put(servMod.id,sma.Application_ID__c);
}
}
Hi Gaurav-Guleria,
In order to get the child object value, we need to iterate the records over a 2 for loops. try the following
String queryString = 'SELECT id,Name, (SELECT id,User__c FROM UserRecordUserAssociations__r) FROM UserRecord__c WHERE id = :ss';
for(CollaborationGroup cg : lstStudent)
{
SObject[] queryParentObject = Database.query(queryString);
for(SObject parentRecord : queryParentObject)
{
SObject[] childRecordsFromParent = parentRecord.getSObjects('UserRecordUserAssociations__r');
for(SObject childRecord : childRecordsFromParent)
{
Id ChildFieldValue1 = (id)childRecord.get('User__c');
if(cg.id != NULL && user.id != ChildFieldValue1)
{
// add the user to the group
CollaborationGroupMember cand = new CollaborationGroupMember(CollaborationGroupId = cg.id,NotificationFrequency = 'D',MemberId = ChildFieldValue1);
chatterGroupMembers.add(cand);
}
}
}