• newbee developer
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
Hello All, Below is my query. 
MyItems = [SELECT Id,Title,LastModifiedById,LastModifiedDate 
                   FROM Knowledge__Kav WHERE Id IN :ProcessInstanceIds ORDER By LastModifiedDate DESC];
ProcessInstanceIds is a set of IDs from another object. 
This query doesnt order by Last Modified Date DESC.
Also, I want to display LastModifiedDate in Date Only format. 
Right now, it displays value as below:
11/18/2017 1:17 AM

I want to display as 11/18/2017
<apex:pageBlockTable value="{! MyItems }" var="r">
     <apex:column headerValue="Title">
      <a target="_blank" href= "/{!r.Id}" >{!r.title}</a>
      </apex:column>          
     <apex:column headerValue="Last Modified Date"><apex:outputfield value="{!r.LastModifiedDate}"/></apex:column>
     <apex:column value="{!r.CreatedById }" headerValue="CreatedBy"/>  
</apex:pageBlockTable>
Hi All,

I want to fetch items which loggedin user can approve and display in a pageblocktable.
Below is my code written so far -

   set<Id> setOfKnowledgeArticleId = new set<Id>();
   set<Id> setOfProcId= new set<Id>();
    
   //Below code gets pending items from ProcessInstance.
    listOfPending = [SELECT Id, TargetObjectId, Status, LastModifiedDate FROM ProcessInstance where Status='Pending' ORDER BY                                                 LastModifiedDate DESC ];
   for(ProcessInstance ProcessInstanceObj:listOfPending )
   {
        //Getting TargetObjectId to query Title,Summary from Custom Object and display in table
        setOfKnowledgeArticleId.add(ProcessInstanceObj.TargetObjectId);     
        // IDs to query the actor ID
        setOfProcId.add(ProcessInstanceObj.Id);        
   }
  
   
   listOfActors = [SELECT Id, ActorId FROM ProcessInstanceWorkitem  where Id IN: setOfProcId ];
   set<Id> setOfActId= new set<Id>();
   for(ProcessInstanceWorkitem pwObj:listOfActors  )
   {
        setOfActId.add(pwObj.Id);     
       
   }
   setOfActId is empty here, even though i know it should not be empty.

Please suggest how to achieve this. 
Hi All,

I have around 10,000 images which I want to import to Salesforce. 
These images are grouped on a specific criteria and contain sub folders. 
I want to know which is the best repository to store images - Documents or Files? 

I am trying to understand which one(Documents or Files) will allow images to be available externally, allow folders/sub folders(if possible), easily bulk import.

Please suggest!
Hi,
I want to fetch record types available for loggedin user from my object(in this case, its knowledge object).
Below is my query which is working fine but not based on permissions: 
SELECT RecordType.Name,RecordType.Id,IsActive FROM RecordType where SobjectType = 'Knowledge__kav'

Now, I want to display those record types which are availble for loggedinuser profile. I want to display in a dropdown. 
Please suggest how to check for loggedin user. 

Thanks!
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.
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];
 
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? 
 
Hello All,

I am working on custom visual force page wherein there's an input box for user to enter some text.
Clicking on "Search" command button, will search in entire knowledge object and return the relevant results. 

Below is my code in VF Page:
<apex:form>
<apex:pageBlockSection title="Search" columns="1">
   <apex:inputText value="{!searchstring}" id="theSearchstring" maxlength="100" size="110"/>
   <apex:commandButton value="Search Article" id="submitButton" style="width:30" reRender="theSearchResults" action="{!searchKBDB}">
   <apex:param name="searchIAS" value="{!searchstring}" />
   </apex:commandButton>
   <apex:panelGroup id="theSearchResults" >
    <knowledge:articleList articleVar="article" Keyword="{!searchstring}">
    <apex:pageBlockTable value="{! SearchArticleList }" rendered="{!IF(searchstring!='',true,false)}" var="a" html-cid="searchTable">
     <apex:column value="{!a.Title}" headerValue="Article Number"/>
     <apex:column value="{!a.PublishStatus}" headerValue="Status"/>
     </apex:pageBlockTable>
    </knowledge:articleList>
     </apex:panelGroup>
     </apex:pageBlockSection>
  </apex:pageBlock>
</apex:form>
Below is my code in Apex Class(Controller) 
public  List<List<sObject>> SearchArticleList     {get;set;}

public PageReference searchKBDB() {
string strX = ApexPages.currentPage().getParameters().get('searchIAS');
 SearchArticleList     = [FIND strX RETURNING Knowledge__Kav(Id, Title, Summary, PublishStatus WHERE PublishStatus='online')];
return null;
}
This code is not working as expected. 

1. I am passing the search text to controller with parameter name as searchIAS.
2. I am using SOSL to search entire knowledge object and fetch results - Bind this to blocktable using the property SearchArticleList

Please suggest where I am goiung wrong.
Instead of SOSL query, should I use SOQL query for such scenarios? I need to perform search against entire knowledge object(for whatever fields are searchable). 

Thanks in advance for any help!!!
Hi,
I want to fetch record types available for loggedin user from my object(in this case, its knowledge object).
Below is my query which is working fine but not based on permissions: 
SELECT RecordType.Name,RecordType.Id,IsActive FROM RecordType where SobjectType = 'Knowledge__kav'

Now, I want to display those record types which are availble for loggedinuser profile. I want to display in a dropdown. 
Please suggest how to check for loggedin user. 

Thanks!
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.
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];
 
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?