0

I am creating a dynamic query string for SOQL. Currently it is working fine as I am using database.query().

For example : string soqlStr = 'select Id, Name From Account where Name = \'Test\'';

database.query(soqlStr);

But, I want to use the same string in java script to call sforce.connection.query();

But, it seems the Javascript is not accepting the soqlStr format, because of where Name = \'Test\''.

We can use document.getElementById() in javascript, but our search page has multiple filter criteria.

is there any other solution where we can use the same soql string for both class and Javascript.

4
  • And how are you constructing the string in javascript? Not sure why you thought a question about your javascript would be appropriate without actually posting what you are doing in JS...... Commented Apr 19, 2017 at 1:51
  • @Eric : I am trying to reuse the soqlStr (which i created in class) in JavaScript. soqlStr is merge valriable in my class. Commented Apr 19, 2017 at 1:55
  • {!JSENCODE(soqlStr)} Commented Apr 19, 2017 at 1:57
  • no problem‌​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​‍​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ Commented Apr 19, 2017 at 2:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.