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
teknicsandteknicsand 

querying current opportunity's related contact information

sforce.connection.query(
"Select o.Opportunity.StageName, o.OpportunityId, o.Contact.Name, o.Contact.Email From OpportunityContactRole o where o.OpportunityId = {!Opportunity.Id}}",
callback);

Can someone tell me what the error is with the above query? I'm trying to get the contact information ( email in particular) of the current opportunity being viewed with the use of OpportunityContactRole.
werewolfwerewolf
Just eyeballing it, I see you have two curly brackets at the end.  So that might be the reason.
teknicsandteknicsand
An error has occurred: {faultcode:'sf:MALFORMED_QUERY', faultstring:'MALFORMED_QUERY: where O.OpportunityId = 0068000000M1lO3 ^ ERROR at Row:1:Column:146 unexpected token: M1lO3', detail:{MalformedQueryFault:{exceptionCode:'MALFORMED_QUERY', exceptionMessage:' where O.OpportunityId = 0068000000M1lO3 ^ ERROR at Row:1:Column:146 unexpected token: M1lO3', row:'1', column:'146', }, }, }

I get this error.
SuperfellSuperfell
you need single quotes around the id value.
teknicsandteknicsand
Thanks, that worked.