You need to sign in to do that
Don't have an account?
newbee developer
SOSL Query for Knowledge Object to retrieve Publish and Draft articles
Hi,
I am displaying results from SOSL query in a page block table.
For salesforce knowledge articles, "where" condition for "publish status" is mandatory to be mentioned.
But This only retrieves articles with online status.
I also need articles with Draft Status, for which i have written another sosl query:
List<List<sObject>> search_results_draft = [FIND :searchStr1 IN ALL FIELDS RETURNING Knowledge__kav
(Id,Title,Summary WHERE PublishStatus = 'Draft') ];
How to combine these two sosl queries and add the result to my object kbList so that i can display in VF page in one single table?
I am displaying results from SOSL query in a page block table.
For salesforce knowledge articles, "where" condition for "publish status" is mandatory to be mentioned.
Public List<Testing__kav> kbList{get;set;}
List<List<sObject>> search_results = [FIND :searchStr1 IN ALL FIELDS RETURNING Knowledge__kav
(Id,Title,Summary WHERE PublishStatus = 'Online') ];
kbList = search_results_dr[0];
List<List<sObject>> search_results = [FIND :searchStr1 IN ALL FIELDS RETURNING Knowledge__kav
(Id,Title,Summary WHERE PublishStatus = 'Online') ];
kbList = search_results_dr[0];
I also need articles with Draft Status, for which i have written another sosl query:
List<List<sObject>> search_results_draft = [FIND :searchStr1 IN ALL FIELDS RETURNING Knowledge__kav
(Id,Title,Summary WHERE PublishStatus = 'Draft') ];
How to combine these two sosl queries and add the result to my object kbList so that i can display in VF page in one single table?
I don't think it will be possible to merge the queries.
But you can combine the results in same list and use that list to display records on vf page
Thanks
Amit.
All Answers
I don't think it will be possible to merge the queries.
But you can combine the results in same list and use that list to display records on vf page
Thanks
Amit.
I already have a list Public List<Testing__kav> kbList{get;set;}
In this list, I am adding Published Articles from the respective query.
How to add the results of second query to same list? Please guide me here!
2,Create another list for published KB
3,Create Third list and use AddAll() method to merge first two list into 3rd list and return 3rd list.