• vishal85
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies

Hello every1,

 

I have to create a user custome field which is based on account custom picklist field. SFDC does nt give me permission to make a lookup relation with the accounts. So can any body please give me any idea how to create this. 

 

Thanks,

Vishal

Hello,

 

Actualy i need a urgent hewlp on the pagination. In KnowledgeArtcileVersion i have three catgories like article, tutorials, videos,

I have a list of all three now I want to do pagination of these records .

So can anybody please help me.

 

Apex code

if(searchType == 'Knowledge') {
            set<Id> similarIds = new Set<Id>();
            TutorialAllList = [SELECT ID,Title, Summary,KnowledgeArticleId,Tutorial_Article_Text__c,PublishStatus FROM Tutorial__kav WHERE PublishStatus =:'Online' AND ((title like :'%'+SearchText+'%') OR (Summary like :'%'+SearchText+'%')) AND KnowledgeArticleId Not In:TutorialIdSet ];
            System.debug('TutorialAllList -->'+TutorialAllList );
            for(Tutorial__kav q : TutorialAllList ){
                similarIds.add(q.KnowledgeArticleId);
                System.debug('similarIds-->'+similarIds);
            }  
            if (similarIds != null && similarIds.size() > 0) {
              Con = new ApexPages.StandardSetController([select id, title, Summary, KnowledgeArticleId, createddate, lastmodifieddate from 
                                Tutorial__kav where PublishStatus =:'Online' AND KnowledgeArticleId in :similarIds order by lastModifieddate desc ]) ;             
              Con.setPageSize(5); 
            }
            ArticleList = [SELECT Sort_Order__c,Summary,KnowledgeArticleId,Title,Article_Text__c,UrlName, id, PublishStatus, (select DataCategoryGroupName, DataCategoryName From DataCategorySelections ) FROM Article__kav Where PublishStatus='online' AND ((title like :'%'+SearchText+'%') OR (Summary like :'%'+SearchText+'%'))];
            ArticleIdSet = new Set<Id>();
            for(Article__kav tk: ArticleList ){
                ArticleIdSet.add(tk.KnowledgeArticleId);
                System.debug('ArticleIdSet -------->'+ArticleIdSet );
                
            }
            if (ArticleIdSet!= null && ArticleIdSet.size() > 0) {
                Con = new ApexPages.StandardSetController([select id, title,KnowledgeArticleId, Summary, createddate, lastmodifieddate from 
                                    Article__kav where PublishStatus =:'Online' AND KnowledgeArticleId in :ArticleIdSet order by lastModifieddate desc ]);             
               // System.debug('ArticleAllList -->'+ArticleAllList );       
                Con.setPageSize(5); 
            }
            videoAllList = [select Video_URL__c, UrlName, Title, sub_title__c, Thumbnail_picture__c, Sort_Order__c, id, PublishStatus,KnowledgeArticleId from Video__kav where PublishStatus='online' order by Sort_Order__c asc];
            set<Id> VideoIds = new Set<Id>();
            for(Video__kav tk: videoAllList ){
                VideoIds.add(tk.KnowledgeArticleId);
                System.debug('VideoIds -------->'+VideoIds );
            }
            if (VideoIds != null && VideoIds.size() > 0) {
                Con = new ApexPages.StandardSetController([select id, title,KnowledgeArticleId,UrlName , Summary, createddate, lastmodifieddate from 
                                Video__kav where PublishStatus =:'Online' AND KnowledgeArticleId in :VideoIds order by lastModifieddate desc ]);             
                //System.debug('VideosList -->'+ VideosList );       
                Con.setPageSize(5); 
            }
        }  
}
public List<Tutorial__kav > getRecords(){
        return objects1 ;
    }
    public List<Article__kav > getArticle(){
        return ArticleAllList ;
    }
    public List<Video__kav > getVideo(){
        return VideosList ;
    }

 

Visualforce code

 

<apex:repeat id="Knowledge" value="{!Records}" var="r" rendered="{!searchType='Knowledge'}">
              <div class="searchResult">
                        <div id="searchResultTitle">
                            <apex:outputLink value="{!$Page.MarketoTutorial}?id={!r.KnowledgeArticleId}">{!r.title}</apex:outputLink>
                        </div>
                        <div id="searchResultBody">{!r.summary}</div>
                       <div id="searchResultFooter">Updated:&nbsp;{!r.lastmodifieddate}</div>
                    </div>
                     <apex:variable var="hasKnowledge" value="true"/>
            </apex:repeat> 
             <apex:repeat id="Knowledge1" value="{!Article}" var="r" rendered="{!searchType='Knowledge'}">
               <div class="searchResult">
                        <div id="searchResultTitle">
                            <apex:outputLink value="{!$Page.MarketoArticle}?id={!r.KnowledgeArticleId}"><apex:outputText value="{!r.Title}" /></apex:outputLink>
                        </div>
                        <div id="searchResultBody"><apex:outputText value="{!r.Summary}" /></div>
                        <div id="searchResultFooter">Updated:&nbsp;<apex:outputText value="{!r.lastmodifieddate}" escape="false"/></div>
                    </div>
                     <apex:variable var="hasKnowledge" value="true"/>
            </apex:repeat> 
            <apex:repeat id="Knowledge2" value="{!Video}" var="a" rendered="{!searchType='Knowledge'}">
                <div class="searchResult" style="float:left;width:700px;">
                    <!--      commented on Heather's Request by vishals@grazitti.com <apex:outputText style="float:right;" escape="false" value="{!urlNameToVideoMap[a.urlName].Thumbnail_picture__c}" /> -->
                     <div id="searchResultTitle">
                            <apex:outputLink value="{!$Page.MarketoVideoLibrary}?title={!urlNameToVideoMap[a.urlName].Title}&id={!urlNameToVideoMap[a.urlName].Id}">{!urlNameToVideoMap[a.urlName].Title}</apex:outputLink> <span style='font-size:14px;color:#000000;'>(Video)</span>
                        </div>
                        <div id="searchResultBody">{!a.summary}</div>
                        <div id="searchResultFooter">Updated:&nbsp;{!a.lastmodifieddate}</div> 
                    </div>
                     <apex:variable var="hasKnowledge" value="true"/>
            </apex:repeat> 
             

This code is working the problem is in pagination.