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
Prasanna Rotti 8Prasanna Rotti 8 

CaseTeamRole query not returning any values in SOQL even though the values are present.

There is a very interesting problem that I am seeing. The below soql 

select Id,name from CaseTeamRole returns 2 rows 


 IdName
10B71a000000PBGRCA4Contributor
20B71a000000PBGWCA4Read Only

where as 

the soql 

select Id,name from CaseTeamRole name = 'Contributor' returns 0 rows. 

The happens only our full sandbox and on production our queries execute perfectly fine. 
Has anyone faced such an issue ? Need help in resolving it.
 
Raj VakatiRaj Vakati
Hi Prasanna  ,
Edit the CaseteamRole 'Contributor' and Save it again 






 
Prasanna Rotti 8Prasanna Rotti 8
Hi Rajamohan, 

I already tried that but it didnt help. 

Weird part is the following query returns the 'Contributor' row

select Id,name from CaseTeamRole where name like '%N%'

but not

select Id,name from CaseTeamRole where name like '%C%'

Thanks
Prasanna
 
Alex EzhilarasanAlex Ezhilarasan
Hi Prasanna,

Try the below query
select Id,name from CaseTeamRole where name like 'Contributor%'
I think there is some value after Contibutor value.

Thanks,
Alex 
 
Prasanna Rotti 8Prasanna Rotti 8
Thanks for your reponse Alex.

Tried the suggesstion, that doesnt work either.

 
Lucas Duque 9Lucas Duque 9
Hello!
Can this query be done by ID ?

In this way below
SELECT Id,name from CaseTeamRole WHERE ID = '10B71a000000PBGRCA4'

I don't know what you really need, but I hope this helps!

Best regards,
Lucas.
Alex EzhilarasanAlex Ezhilarasan
Hi Prasanna,

I also tried in my org, I'm also getting a same issue. Seems Salesforce bug. 

To fix this issue we can do the following,
for( CaseTeamRole ctr : [select Id, name from CaseTeamRole] ){
    
    if(ctr.name == 'Contributor'){
        
        //necessary code here
    }
}
Let me know whether this helps!

Thanks,
Alex