• sachin shah 27
  • NEWBIE
  • 49 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hello,

I have a standatard description field on object "Case" like below
User-added image

The user can enter text of any size and length (lenght very long).

I am displayin it on VF page like below
<div id="t15_1_value" class="t s5_3_nofont" align="left">
                    <apex:outputText value="{!caseDescription}" />
                </div>

As the user cold have entered anything, if the size is big, it exceeds the limitations.

Is there any way we could control the display ?

I can think of two solutions 
1) either control by CSS (i dont know how)
2) get the description, and if it exceeds length then cut short it and if it exceeds rows cutshort it, save in temporaty ariable and display that instread 

Can anyone provide me moe details on solution 2, which can work for me

thanks for suggestion !
  • March 01, 2017
  • Like
  • 0
global class PartnerUserNotLoggedfor30DaysBatch implements Database.Batchable<sObject>{
    
    Date myDate;
    
    Date myDate30Days;
    Id email30DaysTemplateId;
    
    global PartnerUserNotLoggedfor30DaysBatch(){
        myDate = Date.today();
        myDate30Days= Date.today()+30;
        
    }
   
    global Database.querylocator start(Database.BatchableContext BC)
    {
        return Database.getQueryLocator([SELECT Id,name,IsActive,isFrozen__c,IsPortalEnabled,Validity_Date__c,ABB_Manager__c,
                            Profile.name,LastLoginDate,email FROM User WHERE IsPortalEnabled = true AND IsActive = true 
                            AND isFrozen__c = false AND (Profile.Name=:Label.SYS_ABBExtChannelPartnerCommunityUser 
                            OR Profile.Name=:Label.SYS_ABB_Ext_Rep_Community_User 
                            OR Profile.Name=:Label.SYS_ABB_Ext_Agent_Community_User)
                            AND LastLoginDate =: myDate30Days]);   
    }
    global void execute(Database.BatchableContext BC, List<User> listOfUsers)
    { 
    
        Set<Id> setChnlMngrIds=new Set<Id>();
        Set<Id> set30DaysExpUsers = new set<Id>();
        Set<Id> set4WksExpUsers = new set<Id>();
        Map<Id,User> mapOf30DaysExpUsers = new Map<Id,User>();
        Map<Id,User> mapOf4WksExpUsers = new Map<Id,User>();
        Map<Id,User> mapOfABBMngrEmails;
        
        if(listOfUsers.size()>0 && listOfUsers != null){
            
            for(user usr : listOfUsers){
                setChnlMngrIds.add(usr.ABB_Manager__c);
                if(usr.LastLoginDate == myDate30Days){
                    set30DaysExpUsers.add(usr.id);
                    mapOf30DaysExpUsers.put(usr.id,usr);
                }
            }
            if(setChnlMngrIds.size()>0){
            mapOfABBMngrEmails = new Map<Id,User>([Select id,name,email from User where id =: setChnlMngrIds Limit 5000 ]);
            }
            
            List<String> lstToAddRecp = new List<String>();
            List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
            
            if(mapOf30DaysExpUsers != null && mapOf30DaysExpUsers.size()>0){
                Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                for(User usr : mapOf30DaysExpUsers.values()){
                    String BodyText = '<html><body>Dear '+ usr.name +'<br/><br/>'+
                                        'Not Logged for 30 days '+ usr.LastLoginDate+'.'+
                                        '<br/><br/>'+
                                        'To extend your access for next 365 days please contact your ABB Channel Manager.'+
                                        '<br/><br/>Best regards,<br/>SFDC Team<br/><br/>'+
                                        'This is system notification. Please do not reply to this email.'+
                                        '</body></html>'; 
                                        email.setHtmlBody(BodyText );
                    lstToAddRecp.add(usr.email);
                    email.setToAddresses(lstToAddRecp);
                    
                    email.setTargetObjectId(usr.id);
                    email.setSaveAsActivity(false);
                    emails.add(email);    
                    lstToAddRecp.clear();
                }
            }
            
            
            if(emails != null){                    
                Messaging.SendEmailResult[] results = Messaging.sendEmail(emails);
                
            }
            
        }
        
        
    }
    
    global void finish(Database.BatchableContext BC)
      {

      }
}

Thnaks in Advance..
Hello,

I have a standatard description field on object "Case" like below
User-added image

The user can enter text of any size and length (lenght very long).

I am displayin it on VF page like below
<div id="t15_1_value" class="t s5_3_nofont" align="left">
                    <apex:outputText value="{!caseDescription}" />
                </div>

As the user cold have entered anything, if the size is big, it exceeds the limitations.

Is there any way we could control the display ?

I can think of two solutions 
1) either control by CSS (i dont know how)
2) get the description, and if it exceeds length then cut short it and if it exceeds rows cutshort it, save in temporaty ariable and display that instread 

Can anyone provide me moe details on solution 2, which can work for me

thanks for suggestion !
  • March 01, 2017
  • Like
  • 0