function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arun KArun K 

Related SOQL

I have callString as detail object for account object

 

I am trying to retrieve callstrins related account name in below SOQL.

 

But I couldnt  get it.

please help me in writing the right SOQL

 

 

for( Call_String__c doc:trigger.new){
List<Account> AccountList = [Select PDE1__c,Total_Calls_Formula__c,called_by_other__c , OwnerId, Co_Owner__c, Name from Account where name =:doc.Account__r.name ];

 

}

Arun KArun K

When I hard code account name and give as 

"Select PDE1__c,Total_Calls_Formula__c,called_by_other__c , OwnerId, Co_Owner__c, Name from Account where name ='armand'       then It is taking the armand account's related callstring

 

But when i try to get general account name, it is not not taking the related account name

sandeep@Salesforcesandeep@Salesforce

For(Account a : [select id , (select id from callString__r from Account where id in : Trigger.New )]) 

{

for(CallString__c cs : a.callString__r)

{

system.debug('====CallString Record ===='+cs);

}

}

 

Here I have used chidl relationship "CallString__r" between CallString and Accoutn object but you need to findout it on master Detail fied on CallString object.

Mayank_JoshiMayank_Joshi
List<Account> AccountList = [Select PDE1__c,Total_Calls_Formula__c,called_by_other__c , OwnerId, Co_Owner__c, Name,(Select id from callstrins__r) from Account where name =:doc.Account__r.name ];