You need to sign in to do that
Don't have an account?
Rishav Dutta 12
Printing a list inside HTML Email body
I have a list that I am passing to a function to send email. In the email I want to iterate the list but somehow unable. When debug logs are enabled I can see the list size properly, but somehow only the first value is printing. Can anyone help me out?
for (User user1 : userList) { mail.setHtmlBody(user1.Id + '\t \n'); }
Only first value is getting printed because you are directly setting the htmlBody inside for loop. On every iteration you will need to append the Id to the previous value. Something like this :
I hope this helps. Let me know if there are any issues.
Thanks
Try to put debug statement for printing each value user1 in for loop and check if the values are printing.
system.debug('Id' +user1.Id);
Best Regards,
Sandhya