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
Shubham SengarShubham Sengar 

SOQL problem

Create a 'Sales Team' as a related object to 'Lead'...So lead will be parent and Sales Team will be child.
Sales Team Fields : 
Team Member (Looup to user)
Role-(Lookup to role)
*  Write a SOQL Query to get the Team member and his role for particular lead     owner
*  Using data loader extract the same data what you are getting in SOQL Query.
*Write a SOQL query to 'Team member'= XYZ and the lead id='abc'
 
sandeep@Salesforcesandeep@Salesforce
Hi Shubham,
I am considering apis for team member fiels is Team_Member__c, for role it is role__c and for object Sales team it is SalesTeam__c 
*  Write a SOQL Query to get the Team member and his role for particular lead     owner
[select Team_Member__c, role__c from SalesTeam__c where Lead__r.ownerid = 'ANY USER ID' ]
*  Using data loader extract the same data what you are getting in SOQL Query.
it is a practical part
*Write a SOQL query to 'Team member'= XYZ and the lead id='abc'
[select Team_Member__c, role__c from SalesTeam__c where Team_Member__c = 'XYZ' AND ID = 'abc']

Thanks 
Sandeep Singhal
http://www.codespokes.com/
 
Shubham SengarShubham Sengar
Thanks Sandeep ,
but m getting this error

sObject type 'SalesTeam__c' is not supported.

when m using this code


select Team_Member__c, role__c from SalesTeam__c where Lead__r.ownerid = 'ANY USER ID

 
sandeep@Salesforcesandeep@Salesforce
Hi Shubham, 

As I have I have mentioned that I have just used some dummy name as you have not provided all apis so you need to get these correct apis from your Salesforce org. go to Setup> Objects and then you can search for your concerned object.

Thanks
Sandeep Singhal
skype: sandeep.singhal
http://www.codespokes.com/
Shubham SengarShubham Sengar
hi Sandeep 

ya sure m work on that plz let me know how u relate Lead and Sales Team 

see m created a custom object Sales Team (SalesTeam__c)
then created a lookup relationship field  like Role(role__c) and Team Member(SalesTeam__c) with lead 

but how we relate 

Team Member (Looup to user)
Role-(Lookup to role)


 
sandeep@Salesforcesandeep@Salesforce
You can create a User lookup field on SalesTeam__c object and this is how you can co-relate it with actual actual user and user's role.
Shubham SengarShubham Sengar
Hi Sandeep
i'm follow ur suggestion ​...and create same field
but...
if i gona write only this SOQL code​
select Team_Member__c , role__c from SalesTeam__c
it will shows right result but as my case in need ​ a SOQL Query to get the Team member and his role for particular lead  owner
​as u say if i'm following ur code m getting error
select Team_Member__c, role__c from SalesTeam__c where Lead__r.ownerid = 'ANY USER ID'
error ​
role__c from SalesTeam__c where Lead__r.ownerid = 'ANY USER ID'
                                ^
ERROR at Row:1:Column:56
Didn't understand relationship 'Lead__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.