• bannu
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
Hi,

I am trying to get the Salesforce Server IP Address in apex controller. I am unable to find the solution on how to do this. Can any one of you help me?
  • December 03, 2014
  • Like
  • 0

hi all,

i am not able to send emails more than 10

here is my cose with out using batch class can we send emails or else please tell me how to use batch class??

 

public class Weekly_Plan
{
   
    
    
    public Weekly_Plan(ApexPages.StandardController controller)
    {

    }
   /*public String LoggedInUSer = UserInfo.getUserName();    
    public String getUserName()
    {
        return UserInfo.getFirstName()+' '+UserInfo.getLastName();
    }*/    
    public Weekly_Plan__c WeeklyPlan = new Weekly_Plan__c();
    
    public Weekly_Plan__c getuser()
    {
        return WeeklyPlan;
    }
    public void setuser(String name)
    {
        WeeklyPlan.Assinged_To__c = name;
    }
    
    public Weekly_Plan__c getTodate()
    {
        return WeeklyPlan;
    }
    public void setTodate(Date d)
    {
        WeeklyPlan.To_Date__c = d;
    }
    
    public Weekly_Plan__c getFromdate()
    {
        return WeeklyPlan;
    }
    public void setFromdate(Date d)
    {
        WeeklyPlan.From_Date__c = d;
    }
    
    public Plan_Info__c PlanInfo = new Plan_Info__c();
    
    public Plan_Info__c getLocation()
    {
        return PlanInfo;
    }
    public void setLocation(String s)
    {
        PlanInfo.Location__c = s;
    }
    
    public Plan_Info__c getDescription()
    {
        return PlanInfo;
    }
    public void setDescription(String s)
    {
        PlanInfo.description__c = s;
    }
    
    public Plan_Info__c getPlanDate()
    {
        return PlanInfo;
    }
    public void setPlanDate(Date d)
    {
        PlanInfo.Date__c = d;
    }
    
    public List<InnerPlans> PlanInfoList = new List<InnerPlans>();
    public Integer i = 0;
    public void AddPlans()
    {
        if(PlanInfo.Location__c==null || PlanInfo.Description__c==null|| PlanInfo.Date__c==null)
        {
           ApexPages.Message msgAddr = new ApexPages.Message(ApexPages.severity.Error,'Please Enter the Required Fields');
           ApexPages.addMessage(msgAddr);
           
        }
        else
        {
            InnerPlans InnerRef = new InnerPlans();
            InnerRef.plans = PlanInfo;
            InnerRef.UniqueId = i;
            
            PlanInfoList.add(InnerRef);
           
            i++;
            PlanInfo = new Plan_Info__c();
        }
    }
    
    public List<InnerPlans> getPlanInfoList()
    {
        return PlanInfoList;
    }
    
    public class InnerPlans
    {
        public Plan_Info__c plans{get;set;}
        public Integer UniqueId{get;set;}
    }
    public boolean getDisplayPlans()
    {
        if(PlanInfoList.size()>0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    public void DeletePlan()
    {
    Integer k = 0;
    boolean b = true;
        for(InnerPlans IP : PlanInfoList)
        {
            if(IP.UniqueId==Integer.valueOf(System.CurrentPageReference().getParameters().get('DelRec')))
            {
                
                b=false;
                break;
            }
            k++;
        }
        if(!b)
        {
            PlanInfoList.remove(k);
        }
    }
     
    
     
  public Weekly_Plan()
  {    
        
  }   
    public PageReference Submit()
    {
         if(WeeklyPlan.To_Date__c==null || WeeklyPlan.From_Date__c==null)
         {
           ApexPages.Message msgAddr = new ApexPages.Message(ApexPages.severity.Error,'Please Enter the Required Fields');
           ApexPages.addMessage(msgAddr);
           return null;
         }
         else
         {
            //WeeklyPlan.Assinged_To__c = UserInfo.getUserId();
            insert WeeklyPlan;
            List<Plan_Info__c> insertPlanInfo = new List<Plan_Info__c>();
            List<Task> TaskList = new List<Task>();
            for(InnerPlans IPs : PlanInfoList)
            {
            Task t=new Task();
                    IPs.Plans.Weekly_Plan__c = WeeklyPlan.id;
                    insertPlanInfo.add(IPs.Plans);
                    t.OwnerId=WeeklyPlan.Assinged_To__c;
                    t.to_date__c=WeeklyPlan.To_Date__c;
                    t.From_date__c=WeeklyPlan.From_Date__c;
                    t.Description=IPs.Plans.Description__c;
                    t.Subject=IPs.Plans.Location__c;
                    t.ActivityDate=IPs.Plans.Date__c;
                    TaskList.add(t);
                    
            }
            insert insertPlanInfo;
            insert TaskList;
            SendEmail();
            /*      
                  
                    insert t;
            */                   
            return new PageReference('/apex/WeeklyPlanView_VF?Id='+WeeklyPlan.id);
        }
        
    }  
   
    public void SendEmail()
    {
        String assignedTo = '';
        Date date_details=null;
        String subject='';
        String description='';
        String Email_deet='';
        String Name_det='';
        
        List<Plan_Info__c> detail_weeklyplan=[select Date__c,Description__c,Location__c,Weekly_Plan__r.Assinged_To__c from Plan_Info__c where Weekly_Plan__c =: WeeklyPlan.id limit 1];
        System.debug('iii'+detail_weeklyplan);
        
        for(Plan_Info__c p : detail_weeklyplan)
        {
            assignedTo=p.Weekly_Plan__r.Assinged_To__c;
            System.debug('uuu'+assignedTo);
            date_details=p.Date__c;
            subject=p.Location__c;
            description=p.Description__c;
            
            List<User> user_Details=[select Name,Email from User where id =: assignedTo];
            System.debug('idid'+user_Details);
            
            for(User u : user_Details)
            {
                Name_det=u.Name;
                Email_deet=u.Email;
                System.debug('eeee'+Email_deet);
            if(Email_deet!=null)
            {
                Messaging.SingleEmailMessage emaill = new Messaging.SingleEmailMessage();
                string [] toaddress= New string[]{Email_deet};
                emaill.setSubject('Weekly Plan Info');
                
                emaill.setHtmlBody('<html>' + '<h4>'+'Hello      ' +Name_det+ ','+'</h4>' + '<br/>' + 'Weekly Plan Information'+','+ '<br/>'+'<br/>' +'<body align="center">'+'<table border="1" align="center">' + '<th><u>Date</u></th>' + '<th><u>Subject</u></th>' +'<th><u>description</u></th>'+ ' <tr align="center">'+'<td>'+date_details+'</td>'+'<td>'+subject+'</td>'+'<td>'+description+'</td>'+'</tr>' + '</table>' + '</body>' + '</html>');
                emaill.setToAddresses(toaddress);
                Messaging.sendEmail(New Messaging.SingleEmailMessage[]{emaill});
            }
            }
    }
    
  }  
    public PageReference Cancel()
    {
        return new PageReference('/a0E/o');
    }
}

  • June 02, 2012
  • Like
  • 0

hi,

 

i have an url with image,

 

i need to store the properties like width and height of that image seperately into two fields named width and height.

 

urgent please

 

thanking you

  • June 01, 2012
  • Like
  • 0

hi,

i need to store the ratings given for a partiuclar image.

but im not getting the out put.

i have reference the code from http://blog.tquila.com/2012/03/13/recipe-to-add-ajax-dynamic-ratings-in-salesforce-using-jquery/#comment-255.

please help me.

 

apex class:

public with sharing class Rating {
   
 
  public Rating(ApexPages.StandardController controller) {
  Complete_Rating__c co = (Complete_Rating__c)controller.getRecord();
   System.debug('adadaad'+cr_id);
   cr_id = co.id;
  }
   
 
  public string cr_id = ApexPages.currentPage().getParameters().get('Id');
 
  private integer current_rating;
  private Rating__c ratingObj = new Rating__c();
  private integer stored_val;
 
   
  public integer storedVal{
  get{
  try {
  Complete_Rating__c crObj = [SELECT Average_Ratings__c FROM Complete_Rating__c WHERE Id = : cr_id];
 
  stored_val = Integer.valueOf(crObj.Average_Ratings__c);
  }catch(QueryException e) {
  stored_val = 0;
  }
  if(stored_val == null)
  stored_val = 0;
   
  return stored_val;
 }
  }
   
 
  public integer currentRating{
  get {
  if (current_rating == null) {
  try {
  ratingObj = [SELECT Scale__c, Rated_By__c FROM Rating__c WHERE Complete_Rating__c = : cr_id AND Rated_By__c = :UserInfo.getUserId()];
  current_rating = Integer.valueOf(ratingObj.Scale__c);
  }catch(QueryException qe){
  current_rating = 0;
  ratingObj.Rated_By__c = UserInfo.getUserId();
  ratingObj.Complete_Rating__c = cr_id;
  }
  }
  return current_rating;
  }
  set {
  current_rating = value;
  }
  }
 
   
  public void submit() {
  ratingObj.Scale__c = currentRating;
  upsert ratingObj;
  }
  }

 

vf page:

<apex:page standardController="Complete_Rating__c" extensions="Rating" >
  <apex:form >
  <apex:outputPanel id="mainPanel">
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      <script>
      jQuery(document).ready(function($) {
          var storedValue = {!storedVal};
          setThumbs(storedValue); // load the average rating first.
   
          // When clicked, get the position of the thumb and submit it accordingly
          $(".thumb").click(function() {
              var rating = $(this).attr('rating');
              submitRating(rating);
          });
          // Hovering function to show colored and black&white thumbs depending on the cursor position.
          $(".thumb").hover(
              function() {
                  var rating = $(this).attr('rating');
                  setThumbs(rating);
              },
              function() {
                  var storedValue = {!currentRating};
                  setThumbs(storedValue);
              });
      });
   
      function setThumbs(rating){
          turnOnThumbs(rating);
          turnOffThumbs(rating);
      }
   
      function turnOnThumbs(rating){
          for(i=1; i<=rating; i++){
              var thumbId = '#thumb' + i;
             $(thumbId).attr('src', '{!$Resource.Likes_Thumb}');
          }
      }
      function turnOffThumbs(rating){
          for(j=5; j>rating; j--){
              var thumbId = '#thumb' + j;
              $(thumbId).attr('src', '{!$Resource.Dislike_Thumb}');
          }
      }
   
      </script>
      <div align="left">
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb1" rating="1"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb2" rating="2"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb3" rating="3"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb4" rating="4"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb5" rating="5"/>
       </div>
   </apex:outputPanel>
   
   <apex:actionFunction name="submitRating" action="{!submit}" reRender="mainPanel">
       <apex:param name="firstParam" assignTo="{!currentRating}" value=""/>
   </apex:actionFunction>
   
  </apex:form>
  </apex:page>

  • May 31, 2012
  • Like
  • 0

hi,

i need to save the ratings given by the user for a particular image.

i am not able to write a code.

please help me.

very urgent

  • May 31, 2012
  • Like
  • 0

hi all,

i am not able to send emails more than 10

here is my cose with out using batch class can we send emails or else please tell me how to use batch class??

 

public class Weekly_Plan
{
   
    
    
    public Weekly_Plan(ApexPages.StandardController controller)
    {

    }
   /*public String LoggedInUSer = UserInfo.getUserName();    
    public String getUserName()
    {
        return UserInfo.getFirstName()+' '+UserInfo.getLastName();
    }*/    
    public Weekly_Plan__c WeeklyPlan = new Weekly_Plan__c();
    
    public Weekly_Plan__c getuser()
    {
        return WeeklyPlan;
    }
    public void setuser(String name)
    {
        WeeklyPlan.Assinged_To__c = name;
    }
    
    public Weekly_Plan__c getTodate()
    {
        return WeeklyPlan;
    }
    public void setTodate(Date d)
    {
        WeeklyPlan.To_Date__c = d;
    }
    
    public Weekly_Plan__c getFromdate()
    {
        return WeeklyPlan;
    }
    public void setFromdate(Date d)
    {
        WeeklyPlan.From_Date__c = d;
    }
    
    public Plan_Info__c PlanInfo = new Plan_Info__c();
    
    public Plan_Info__c getLocation()
    {
        return PlanInfo;
    }
    public void setLocation(String s)
    {
        PlanInfo.Location__c = s;
    }
    
    public Plan_Info__c getDescription()
    {
        return PlanInfo;
    }
    public void setDescription(String s)
    {
        PlanInfo.description__c = s;
    }
    
    public Plan_Info__c getPlanDate()
    {
        return PlanInfo;
    }
    public void setPlanDate(Date d)
    {
        PlanInfo.Date__c = d;
    }
    
    public List<InnerPlans> PlanInfoList = new List<InnerPlans>();
    public Integer i = 0;
    public void AddPlans()
    {
        if(PlanInfo.Location__c==null || PlanInfo.Description__c==null|| PlanInfo.Date__c==null)
        {
           ApexPages.Message msgAddr = new ApexPages.Message(ApexPages.severity.Error,'Please Enter the Required Fields');
           ApexPages.addMessage(msgAddr);
           
        }
        else
        {
            InnerPlans InnerRef = new InnerPlans();
            InnerRef.plans = PlanInfo;
            InnerRef.UniqueId = i;
            
            PlanInfoList.add(InnerRef);
           
            i++;
            PlanInfo = new Plan_Info__c();
        }
    }
    
    public List<InnerPlans> getPlanInfoList()
    {
        return PlanInfoList;
    }
    
    public class InnerPlans
    {
        public Plan_Info__c plans{get;set;}
        public Integer UniqueId{get;set;}
    }
    public boolean getDisplayPlans()
    {
        if(PlanInfoList.size()>0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    public void DeletePlan()
    {
    Integer k = 0;
    boolean b = true;
        for(InnerPlans IP : PlanInfoList)
        {
            if(IP.UniqueId==Integer.valueOf(System.CurrentPageReference().getParameters().get('DelRec')))
            {
                
                b=false;
                break;
            }
            k++;
        }
        if(!b)
        {
            PlanInfoList.remove(k);
        }
    }
     
    
     
  public Weekly_Plan()
  {    
        
  }   
    public PageReference Submit()
    {
         if(WeeklyPlan.To_Date__c==null || WeeklyPlan.From_Date__c==null)
         {
           ApexPages.Message msgAddr = new ApexPages.Message(ApexPages.severity.Error,'Please Enter the Required Fields');
           ApexPages.addMessage(msgAddr);
           return null;
         }
         else
         {
            //WeeklyPlan.Assinged_To__c = UserInfo.getUserId();
            insert WeeklyPlan;
            List<Plan_Info__c> insertPlanInfo = new List<Plan_Info__c>();
            List<Task> TaskList = new List<Task>();
            for(InnerPlans IPs : PlanInfoList)
            {
            Task t=new Task();
                    IPs.Plans.Weekly_Plan__c = WeeklyPlan.id;
                    insertPlanInfo.add(IPs.Plans);
                    t.OwnerId=WeeklyPlan.Assinged_To__c;
                    t.to_date__c=WeeklyPlan.To_Date__c;
                    t.From_date__c=WeeklyPlan.From_Date__c;
                    t.Description=IPs.Plans.Description__c;
                    t.Subject=IPs.Plans.Location__c;
                    t.ActivityDate=IPs.Plans.Date__c;
                    TaskList.add(t);
                    
            }
            insert insertPlanInfo;
            insert TaskList;
            SendEmail();
            /*      
                  
                    insert t;
            */                   
            return new PageReference('/apex/WeeklyPlanView_VF?Id='+WeeklyPlan.id);
        }
        
    }  
   
    public void SendEmail()
    {
        String assignedTo = '';
        Date date_details=null;
        String subject='';
        String description='';
        String Email_deet='';
        String Name_det='';
        
        List<Plan_Info__c> detail_weeklyplan=[select Date__c,Description__c,Location__c,Weekly_Plan__r.Assinged_To__c from Plan_Info__c where Weekly_Plan__c =: WeeklyPlan.id limit 1];
        System.debug('iii'+detail_weeklyplan);
        
        for(Plan_Info__c p : detail_weeklyplan)
        {
            assignedTo=p.Weekly_Plan__r.Assinged_To__c;
            System.debug('uuu'+assignedTo);
            date_details=p.Date__c;
            subject=p.Location__c;
            description=p.Description__c;
            
            List<User> user_Details=[select Name,Email from User where id =: assignedTo];
            System.debug('idid'+user_Details);
            
            for(User u : user_Details)
            {
                Name_det=u.Name;
                Email_deet=u.Email;
                System.debug('eeee'+Email_deet);
            if(Email_deet!=null)
            {
                Messaging.SingleEmailMessage emaill = new Messaging.SingleEmailMessage();
                string [] toaddress= New string[]{Email_deet};
                emaill.setSubject('Weekly Plan Info');
                
                emaill.setHtmlBody('<html>' + '<h4>'+'Hello      ' +Name_det+ ','+'</h4>' + '<br/>' + 'Weekly Plan Information'+','+ '<br/>'+'<br/>' +'<body align="center">'+'<table border="1" align="center">' + '<th><u>Date</u></th>' + '<th><u>Subject</u></th>' +'<th><u>description</u></th>'+ ' <tr align="center">'+'<td>'+date_details+'</td>'+'<td>'+subject+'</td>'+'<td>'+description+'</td>'+'</tr>' + '</table>' + '</body>' + '</html>');
                emaill.setToAddresses(toaddress);
                Messaging.sendEmail(New Messaging.SingleEmailMessage[]{emaill});
            }
            }
    }
    
  }  
    public PageReference Cancel()
    {
        return new PageReference('/a0E/o');
    }
}

  • June 02, 2012
  • Like
  • 0

hi,

 

i have an url with image,

 

i need to store the properties like width and height of that image seperately into two fields named width and height.

 

urgent please

 

thanking you

  • June 01, 2012
  • Like
  • 0

hi,

i need to store the ratings given for a partiuclar image.

but im not getting the out put.

i have reference the code from http://blog.tquila.com/2012/03/13/recipe-to-add-ajax-dynamic-ratings-in-salesforce-using-jquery/#comment-255.

please help me.

 

apex class:

public with sharing class Rating {
   
 
  public Rating(ApexPages.StandardController controller) {
  Complete_Rating__c co = (Complete_Rating__c)controller.getRecord();
   System.debug('adadaad'+cr_id);
   cr_id = co.id;
  }
   
 
  public string cr_id = ApexPages.currentPage().getParameters().get('Id');
 
  private integer current_rating;
  private Rating__c ratingObj = new Rating__c();
  private integer stored_val;
 
   
  public integer storedVal{
  get{
  try {
  Complete_Rating__c crObj = [SELECT Average_Ratings__c FROM Complete_Rating__c WHERE Id = : cr_id];
 
  stored_val = Integer.valueOf(crObj.Average_Ratings__c);
  }catch(QueryException e) {
  stored_val = 0;
  }
  if(stored_val == null)
  stored_val = 0;
   
  return stored_val;
 }
  }
   
 
  public integer currentRating{
  get {
  if (current_rating == null) {
  try {
  ratingObj = [SELECT Scale__c, Rated_By__c FROM Rating__c WHERE Complete_Rating__c = : cr_id AND Rated_By__c = :UserInfo.getUserId()];
  current_rating = Integer.valueOf(ratingObj.Scale__c);
  }catch(QueryException qe){
  current_rating = 0;
  ratingObj.Rated_By__c = UserInfo.getUserId();
  ratingObj.Complete_Rating__c = cr_id;
  }
  }
  return current_rating;
  }
  set {
  current_rating = value;
  }
  }
 
   
  public void submit() {
  ratingObj.Scale__c = currentRating;
  upsert ratingObj;
  }
  }

 

vf page:

<apex:page standardController="Complete_Rating__c" extensions="Rating" >
  <apex:form >
  <apex:outputPanel id="mainPanel">
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
      <script>
      jQuery(document).ready(function($) {
          var storedValue = {!storedVal};
          setThumbs(storedValue); // load the average rating first.
   
          // When clicked, get the position of the thumb and submit it accordingly
          $(".thumb").click(function() {
              var rating = $(this).attr('rating');
              submitRating(rating);
          });
          // Hovering function to show colored and black&white thumbs depending on the cursor position.
          $(".thumb").hover(
              function() {
                  var rating = $(this).attr('rating');
                  setThumbs(rating);
              },
              function() {
                  var storedValue = {!currentRating};
                  setThumbs(storedValue);
              });
      });
   
      function setThumbs(rating){
          turnOnThumbs(rating);
          turnOffThumbs(rating);
      }
   
      function turnOnThumbs(rating){
          for(i=1; i<=rating; i++){
              var thumbId = '#thumb' + i;
             $(thumbId).attr('src', '{!$Resource.Likes_Thumb}');
          }
      }
      function turnOffThumbs(rating){
          for(j=5; j>rating; j--){
              var thumbId = '#thumb' + j;
              $(thumbId).attr('src', '{!$Resource.Dislike_Thumb}');
          }
      }
   
      </script>
      <div align="left">
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb1" rating="1"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb2" rating="2"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb3" rating="3"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb4" rating="4"/>
      <img src="{!$Resource.Likes_Thumb}" width="25" height="25" id="thumb5" rating="5"/>
       </div>
   </apex:outputPanel>
   
   <apex:actionFunction name="submitRating" action="{!submit}" reRender="mainPanel">
       <apex:param name="firstParam" assignTo="{!currentRating}" value=""/>
   </apex:actionFunction>
   
  </apex:form>
  </apex:page>

  • May 31, 2012
  • Like
  • 0

hi,

i need to save the ratings given by the user for a particular image.

i am not able to write a code.

please help me.

very urgent

  • May 31, 2012
  • Like
  • 0

As I am new to salesforce , can you please help me out in writing batch apex?
Our requirement is to send a mass email to all EventUsers(child of contact) at specified interval of time.
Please reply ASAP as it is an urgent requirement.