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
David SomekhDavid Somekh 

Query Error In Custom Object

Hi,
I wrote query in JavaScript and I get this message: "unterminated string constant".
I think it happens because the line break (maybe not).
How can i solve it?
 
the query:
var records = sforce.connection.query("select Date_Of_Order__c,
from Dongle__c,
where (Name = 'dongNum')");
 
Thanks,
Chen
GanuGanu

Try this,

var records = sforce.connection.query("select Id, Date_Of_Order__c from Dongle__c where Name = 'dongNum'");

-- Ganu

David SomekhDavid Somekh
still don't work...
maybe someone have another suggestion ?
werewolfwerewolf
Don't break the string across multiple lines like that.  Some languages don't like that.
David SomekhDavid Somekh
Thanks its help, but now I have another error:
Code:
{faultcode:’sf:MALFORMED_QUERY’, faultstring:’MALFORMAD_QUERY:
Select Date_Of_Order__c, From Dongle__c, Where Name = 30126
ERROR at Row:1:Column:26
Unexpected token: From’, detail:{MalformedQueryFault:{exceptionCode:’MALFORMED_QUERY’, exceptionMessage:’
Select Date_Of_Order__c, From Dongle__c, Where Name = 30126
ERROR at Row:1:Column:26
unexpected token: From’, row:’1’, column :’26’,},},}  


 
How can i solve this?

Thanks, Chen 

SteveBowerSteveBower
Remove the commas before the words "from" and "where".  e.g.

"Select xxx from yyy where zzz" and not "select xxx, from yyy, where zzz".

Best, Steve.