Posted By

d3developer on 08/11/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

terrerouge


@fractastical CustomObject + Chat Post Wrapper


 / Published in: Other
 

  1. public with sharing class TaskWrapper {
  2.  
  3. public Boolean markedComplete { get; set; }
  4. public Boolean markedIncomplete { get; set; }
  5. public Boolean markedReviewed { get; set; }
  6. public Boolean created { get; set; }
  7. public String assignedTo { get; set; }
  8. //public Boolean markedReviewedIncomplete { get; set; }
  9. public NewsFeed taskFeedItem { get; set; }
  10. public Integer commentCount { get; set; }
  11.  
  12. public taskWrapper() {
  13. markedComplete = false;
  14. markedIncomplete = false;
  15. markedReviewed = false;
  16. created = false;
  17. assignedTo = '';
  18. //taskFeedItem = new NewsFeed();
  19.  
  20. }
  21.  
  22. public Boolean successfulInitialize (NewsFeed tf, String tdid)
  23. {
  24. Boolean success = true;
  25. taskFeedItem = tf;
  26. commentCount = tf.FeedComments.size();
  27.  
  28. for(Integer i=0; i < tf.FeedTrackedChanges.size(); i++)
  29. {
  30. System.debug('Field name:' + tf.FeedTrackedChanges[i].FieldName + ' New Value ' + tf.FeedTrackedChanges[i].newValue);
  31. if (tf.FeedTrackedChanges[i].FieldName == 'ToDoItem__c.Completed__c')
  32. {
  33. if(tf.FeedTrackedChanges[i].newValue == true)
  34. markedComplete = true;
  35. if(tf.FeedTrackedChanges[i].newValue == false)
  36. markedIncomplete = true;
  37. }
  38. else if (tf.FeedTrackedChanges[i].FieldName == 'ToDoItem__c.Reviewed__c')
  39. {
  40. if(tf.FeedTrackedChanges[i].newValue == true)
  41. markedReviewed = true;
  42. // This should never be changed due to our use cases
  43. // if(newValue == 'false')
  44. // markedIncomplete;
  45. }
  46. else if (tf.FeedTrackedChanges[i].FieldName == 'created')
  47. {
  48. created = true;
  49. //System.debug('created by: ' + tf.CreatedBy.FirstName + ' ' + tf.CreatedBy.LastName);
  50. try {
  51. ToDoItem__c tdi = [SELECT assigned_to__r.name from ToDoItem__c where id = :tdid LIMIT 1];
  52. assignedTo = tdi.assigned_to__r.name;
  53. }
  54. catch (Exception e) {
  55. // Item may have been deleted
  56. }
  57. }
  58. else
  59. {
  60. success = false;
  61. }
  62.  
  63. }
  64. return success;
  65.  
  66. }
  67.  
  68.  
  69. }

Report this snippet  

You need to login to post a comment.