Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. // updating the bulk records in custom object
  2. list<Student__c> stnewlist=new list<Student__c>();
  3. list<Student__c> stlist=[select id, name,COURSE_FEE__c,library__c from student__c where Country__c='India'];
  4. for(Student__c st:stlist)
  5. {
  6. system.debug('student record is'+st);
  7. st.COURSE_FEE__c= st.COURSE_FEE__c - st.COURSE_FEE__c+0.1;
  8. st.E_mail_id__c='bulkrecords@bulk.com';
  9. st.States__c='Andhra Pradesh';
  10. st.library__c='a029000000JwWDt';
  11. st.City__c='Vijayawada';
  12. stnewlist.add(st);
  13. }
  14. update stnewlist;
  15.  
  16. st.COURSE_FEE__c= st.COURSE_FEE__c - st.COURSE_FEE__c+0.1;
  17.  
  18. if (st.COURSE_FEE__c != null) {
  19. st.COURSE_FEE__c= st.COURSE_FEE__c - st.COURSE_FEE__c+0.1;
  20. } else {
  21. // Handle null case
  22. }
  23.  
  24. List<student__c> stlist = new List<student__c>();
  25. stlist = [select id, name,COURSE_FEE__c,library__c from student__c where Country__c='India']
  26.  
  27. List<student__c> stnewlist = new List<student__c>();
  28.  
  29. //Check if List is not empty before proceeding to the business logic
  30.  
  31. if(!stList.IsEmpty()) {
  32.  
  33. }
  34.  
  35. // updating the bulk records in custom object
  36. List<Student__c> stnewlist=new List<Student__c>();
  37. list<Student__c> stlist= new list<Student__c>();
  38. stlist = [select id, name, COURSE_FEE__c, library__c from student__c where Country__c='India'];
  39. for(Student__c st : stlist)
  40. {
  41. system.debug('student record is'+st);
  42. if( st.COURSE_FEE__c!= null)
  43. st.COURSE_FEE__c= st.COURSE_FEE__c - st.COURSE_FEE__c+0.1;
  44. st.E_mail_id__c='bulkrecords@bulk.com';
  45. st.States__c='Andhra Pradesh';
  46. st.library__c='a029000000JwWDt';
  47. st.City__c='Vijayawada';
  48. stnewlist.add(st);
  49. }
  50. update stnewlis;
  51.  
  52. / updating the bulk records in custom object
  53. List< student__c > stlist=[select id, name,COURSE_FEE__c,library__c from student__c where Country__c='India'];
  54. for(Student__c st:stlist)
  55. {
  56. system.debug('student record is'+st);
  57. st.COURSE_FEE__c= st.COURSE_FEE__c - st.COURSE_FEE__c+0.1;
  58. st.E_mail_id__c='bulkrecords@bulk.com';
  59. st.States__c='Andhra Pradesh';
  60. st.library__c='a029000000JwWDt';
  61. st.City__c='Vijayawada';
  62. // stnewlist.add(st); // not required //
  63. }
  64. //update stnewlist; // not required, use existing list which is already changed and just update it.
  65. update stlist;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement