4

I'm working on a custom search page, which will search through the fields of the Project object. I use dynamic SOQL query similar to that:

SELECT Id, 
            Name, 
            Link_Test__c, 
            Technology_Sinonym__c, 
            Internal_Synonym__c, 
            Innovators__c 
    FROM Technology__c 
    WHERE(Technology_Limitations__c != 'ddd' AND Name != 'www') 
    ORDER BY Name DESC LIMIT 50

but the error that display :

Error: field 'Technology_Limitations__c' can not be filtered in query call

this filed id Rich Text so I know I cant use where operator in SOQL so I am wonder if I can use in SOSL or Do you have author solution

  • Welcome to SF Stack Exchange. Your question seems to be asking the same as this recent question: Filtering by Long Text Area field in SOQL You should be able to find your answer in here. (Unfortunately, it might not make you happy.) – dphil Oct 29 '14 at 14:13
  • but I am asking if i can use in SOSL to do that casue i didnt use in sosl at all and i wonder if to do this way or to try to learn this – Racheli Oct 29 '14 at 14:14
  • I suppose that does make it a slightly different question. Unfortunately the answer is still the same. I think I just came up with a workaround though and will soon post it. – dphil Oct 29 '14 at 14:20
  • Currently this question is very SOQL oriented and it's not entirely clear what type of response you're receiving regarding SOSL. Would you consider editing/updating your question and title to highlight the specific question around SOSL and what you've tried in SOSL ? – Samuel De Rycke Oct 29 '14 at 17:51
  • i didnt know SOSL but i am asking if it possible in SOSL – Racheli Oct 30 '14 at 7:40
3

I just discovered a work around for this here. Create a Formula field that uses the LEFT formula and filter on that. You cannot filter on the ENTIRE long text but you can filter on part of it:

Legal_Street__c is a long text area. I created a formula field call StreetConc__c:

LEFT(Legal_Street__c, 40)

I then created a dummy record and put the text 'testingthis' in the Legal_Street__c field. From here I filtered on this formula field.

System.debug('answer = ' + [SELECT Name FROM Account WHERE StreetConc__c LIKE 'testing%']);

You should be able to apply this to both SOQL and SQL.

NOTE: You don't need to use 40 for the LEFT in the formula field. It was just an example.

  • but i dont understand how can its help string text not equal to rich text – Racheli Oct 29 '14 at 14:46
  • @Racheli Rich text IS string text. When it is displayed to the User, it just applies the html to what the User sees. It might instead make sense to use '%testing%' so that you can find specific words inside of tags as well. It is definitely more complex to search on but this is the closest you will get. – dphil Oct 29 '14 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.