function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sharmila SahooSharmila Sahoo 

I have a field of type rich text area and one field of type URL. My requirement is when I click on field of type rich text area(Image) it should move to the location as specified by other field of type URL.Any help will be greatly appreciated.

NagendraNagendra (Salesforce Developers) 
Hi Sharmila,

Where are you implementing this requirement? On a standard page, a detail page, etc? Do you have any custom code you've already written?

Kindly post your code so that we can have better understanding of it which results in good and easy troubleshooting.

Best Regards,
Nagendra.P
Sharmila SahooSharmila Sahoo
I need to use it in VF page.


    <apex:outputLink target="_blank" value="{!recordWrapperForContent.sfdcObject['Url__c']}">  <apex:outputField value="{!temp.sfdcObject['Navigation_Image__c']}"  style="height: 240px !important; width:100px !important;" ></apex:outputField></apex:outputLink>
                            
This code I am using Url__c field of type URL and Navigation IMAGE is image.  "recordWrapperForContent.sfdcObject" is wrapper class variable This is  So what I want is when I click on field of type rich text area(Image) it should move to the location as specified by other field of type URL.I am getting this error  when I click on Image


"
The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores."
NagendraNagendra (Salesforce Developers) 
Hi Sharmila,

Seems no issue with the above code,please let us know whether you are using a standard controller or custom controller.

Kindly post the complete code snippet what you have.

Best Regards,
Nagendra.P
Sharmila SahooSharmila Sahoo
I am using Custom Controller
Main class

/*---------------------------------------------------------------------------------------------------------------------------
** Audit Trail:
**     Date         Author          Change Description
** 26-Dec-2014      Wipro           Changes in query of Constructor iNeed_CatalogueController for CR CATALOGUE CUSTOM SORTING 
** 23-Sep-2016      Infosys         Added code for MyTravel Module to fetch Level2 data from Picklist Value Available object.                               
----------------------------------------------------------------------------------------------------------------------------*/

public with sharing class iNeedMyTravelHomeController extends iNeedContentPackUtility{

    
    
    public  set<ID> contentPackIDs {get;set;}
    public boolean isContentPackAvailable {get;set;}
    public boolean isOfferingAvailable {get;set;}
    public ID defaultImageID{get;set;}
    
    public list<iNeed_Home.wAnnouncement> announcements{get;set;}
    
    public Picklist_Values_Available__c pickAvailObj {get;set;}
    public TravelDocumentWrapper recordWrapperForContent{get;set;}
    
    public List<TravelDocumentWrapper> childRecordWrapperList{get;set;}
     
    

    
    public iNeedMyTravelHomeController(){
        defaultImageID = defaultimageconstant;
        isContentPackAvailable = true;
        isOfferingAvailable = false;
        contentPackIDs = currCont == null ? returnContentPackIDs(null) : returnContentPackIDs(currCont.ID);
        
        if(contentPackIDs == null || contentPackIDs.isEmpty()){
            isContentPackAvailable = false;
            
           
           
        }
        
        
        childRecordWrapperList=new List<TravelDocumentWrapper>();
        
        /* Start of code to extract Level 1 data */
            User us=[Select ContactId from User Where Id=:UserInfo.getUserId()];
            system.debug('User'+us);
            Set<ID> contentId=returnContentPackIDs(us.ContactId);
            system.debug('contentId'+contentId);
            
            pickAvailObj=[select Picklist_Value__c,Picklist_Value__r.Parent__c,Picklist_Value__r.Parent__r.Parent__c,Picklist_Value__r.Picklist_Type__c,Picklist_Value__r.Label__c,picklist_Value__r.Navigation_Level__c,Picklist_Value__r.Order_Number__c,iNeed_Content_Pack__r.Description__c,Picklist_Value__r.Article_Number__c from Picklist_Values_Available__c where Picklist_Value__r.Picklist_Type__c='Navigation' and Picklist_Value__r.Navigation_Level__c='Level 1' and iNeed_Content_Pack__c in:contentId order by Picklist_Value__r.Order_Number__c];
            System.debug('pickAvailObj value for Ineed '+pickAvailObj);
        
            recordWrapperForContent=new TravelDocumentWrapper(pickAvailObj);
        
            system.debug('pickAvailObj.Picklist_Value__r.Article_Number__c'+pickAvailObj.Picklist_Value__r.Article_Number__c);
            try{
                Information__kav  articleData=[select ArticleNumber,Title,Summary,Detail__c from Information__kav  where ArticleNumber=:pickAvailObj.Picklist_Value__r.Article_Number__c and Type__c='Navigation' and PublishStatus='Online' and Language = 'en_US' and Status__c='Active'];
                
                system.debug('articleData'+articleData);
                recordWrapperForContent.docArticle=articleData;}
        
            catch(Exception e){
                  system.debug('Exception for article'+e);
                  }
           /* End  of code to extract Level 1 data */       
                  
               
                       
           /* Start of Code for Child Records display  */
           
            
            
            List<Picklist_Values_Available__c> childPickRecordsList=[select Picklist_Value__r.Picklist_Type__c,Picklist_Value__r.Label__c,picklist_Value__r.Navigation_Level__c,Picklist_Value__r.Order_Number__c,iNeed_Content_Pack__r.Description__c,Picklist_Value__r.Article_Number__c from Picklist_Values_Available__c where Picklist_Value__r.Parent__c=:pickAvailObj.Picklist_Value__c and Picklist_Value__r.Picklist_Type__c='Navigation' and iNeed_Content_Pack__c in:contentId order by Picklist_Value__r.Order_Number__c] ;
        
            system.debug('childPickRecordsList'+childPickRecordsList);
            
            List<String> articleNos=new List<String>();
            
            
            for(Picklist_Values_Available__c tempChildPickForArticle:childPickRecordsList){
                articleNos.add(tempChildPickForArticle.Picklist_Value__r.Article_Number__c);
            }
            
            system.debug('articleNos'+articleNos);
            List<Information__kav> articleDataForChild=new List<Information__kav>();
            
            articleDataForChild=[select ArticleNumber,Title,Summary,Detail__c from Information__kav  where ArticleNumber in :articleNos and PublishStatus='Online' and Language = 'en_US' and Type__c='Navigation'];
       
            system.debug('articleDataForChild'+articleDataForChild);
        
            for(Picklist_Values_Available__c childPickObj:childPickRecordsList){
                TravelDocumentWrapper tempchildPickObj=new TravelDocumentWrapper(childPickObj);
                
                for(Information__kav artData:articleDataForChild){
                
                     try{
                     
                        if(childPickObj.Picklist_Value__r.Article_Number__c==artData.ArticleNumber){
                        
                            if(artData.Summary!=null && artData.Summary!=''){
                            
                               if(artData.Summary.length()>200)
                                   { //String tempBriefSummary=artData.Summary.substring(0,200);
                                    tempchildPickObj.briefSummary=artData.Summary.substring(0,200);
                                    //artData.Summary=tempBriefSummary;
                                    }
                                    
                                 else{
                                      tempchildPickObj.briefSummary=artData.Summary;
                                 }
                              }
                                
                            
                               
                            
                            tempchildPickObj.docArticle=artData;
                        }
                    }
                    
                    catch(Exception e){
                        system.debug('Exception for child article'+e);
                    }
                
                }
                   
                    childRecordWrapperList.add(tempchildPickObj);
                }
             system.debug('childRecordWrapperList'+childRecordWrapperList);
           
           
           /* End  of Code for Child Records display  */
      
         
           
           
                   
        announcements = returnAnnouncements(contentPackIDs);

    }

   
   // Method to return announcement 
  public list<iNeed_Home.wAnnouncement> returnAnnouncements(set<ID> contentPackIDs){
        /*if(contentPackIDs == null)
            contentPackIDs = returnContentPackIDs(null); */
        System.debug('@@@@@@ contentpack id' + contentPackIDs);

        if(contentPackIDs != null){
            set<ID> allArticlesAvailable = returnArticlesAvailable(contentPackIDs);
            list<Information__kav> Announcements;
            if(allArticlesAvailable != null){
                /* Start Addedd for CR-1623 */
                system.debug('******allArticlesAvailable1111*****'+allArticlesAvailable);
                system.debug('******allArticlesAvailable1111.size()*****'+allArticlesAvailable.size());
                //Announcements = [Select Title, Summary, Detail__c, Language,URL_for_Announcement__c, ArticleType, UrlName from Information__kav where KnowledgeArticleId IN: allArticlesAvailable and PublishStatus = 'online' and Language = 'en_US' and id=:'kA2n0000000Cqbk'];
                
                Announcements = [Select Title, Summary, Detail__c, Language,URL_for_Announcement__c, ArticleType, UrlName,End_Date_for_Campaign__c from Information__kav where Type__c = 'Travel Announcement' and KnowledgeArticleId IN: allArticlesAvailable and PublishStatus = 'online' and Language = 'en_US' and End_Date_for_Campaign__c >=: system.today() ORDER BY LastPublishedDate DESC, LastModifiedDate DESC limit 10];
                system.debug('******Announcements1111*****'+Announcements);
                system.debug('******Announcements1111.size()*****'+Announcements.size());
                //system.debug('******End_Date_for_Campaign__c1111******'+End_Date_for_Campaign__c );
                system.debug('******system.today()1111******'+system.today());
                
                
                /* End Added for CR-1623 */
                
                if(!Announcements.IsEmpty()){
                    list<iNeed_Home.wAnnouncement> retList = new list<iNeed_Home.wAnnouncement>();
                    for(Integer i = 0; i < Announcements.size() ; i++){
                        Information__kav ann = Announcements[i];
                        iNeed_Home.wAnnouncement wa = new iNeed_Home.wAnnouncement(ann, i);
                        retList.add(wa);
                    }
                    
                    system.debug('retList'+retList);
                    return retList;                   
                }
            }
        }        
        // module to return default announcement
        list<iNeed_Home.wAnnouncement> defList = new list<iNeed_Home.wAnnouncement>();
        List<Information__kav> defaultAnnouncements = [Select Title, Summary, Detail__c, Language,URL_for_Announcement__c, ArticleType, UrlName from Information__kav where Type__c = 'Travel Announcement' and PublishStatus = 'online' and Language = 'en_US' and ArticleNumber =: defaultarticlenumber];//UrlName IN  ('Sample-Announcement','Sample-Announcement2')];
        system.debug('*******defaultAnnouncements********'+defaultAnnouncements);
        system.debug('*******defaultAnnouncements.size()********'+defaultAnnouncements.size());
        for(Integer i = 0; i < defaultAnnouncements.size() ; i++){
            Information__kav inf = defaultAnnouncements[i];
            iNeed_Home.wAnnouncement wann = new iNeed_Home.wAnnouncement(inf, i);
            defList.add(wann);
        }
        
        system.debug('defList'+defList);
        System.debug('@@@@@@@@@@@@ Announcement' +defList);
        return defList;  
    }
    
}

                                                
 	EditDeleteDownloadSecurityShow Dependencies
Copyright © 2000-2016 salesf
This is wrapper class

public class TravelDocumentWrapper_v2
{
     
   public TravelDocumentWrapper_v2(Picklist_Values_Available__c pickObj)
      {
              docTitle=pickObj.Picklist_Value__r.Label__c;
            
              docArticle=new Information__kav();
              docLevel=pickObj.Picklist_Value__r.Navigation_Level__c;
              isCurrentActive=false;
              docRecordId=pickObj.id;
              parentRecId=pickObj.Picklist_Value__c;
              travelDocWrapperList=new List<TravelDocumentWrapper_v2>();
              briefSummary='';
              //docImage=  EncodingUtil.base64Decode(pickObj.Picklist_Value__r.Navigation_Image__c);
              sfdcObject=pickObj.Picklist_Value__r;
      }
      
     // public Blob docImage{get;set;}
      public Sobject sfdcObject{get;set;}  
      public String parentRecId{get;set;}
      public String docTitle{get;set;}
      
     
      public Information__kav docArticle{get;set;}
      public String docLevel{get;set;}
      public Boolean isCurrentActive{get;set;}
     
      public String docRecordId{get;set;}
      public List<TravelDocumentWrapper_v2> travelDocWrapperList{get;set;}
      public String briefSummary{get;set;}
      
      
      
        

}


Fields are : URL   Url__c   URL(255)
 Navigation ImageNavigation_Image__cRich Text Area(32768)