Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. for(String username :listmaker.keySet()){
  2.  
  3. if(username != null){
  4. sendgridsettings__c sendSetting = sendgridsettings__c.getInstance(username);
  5. system.debug(sendSetting);
  6.  
  7. // Storing parameters to a call as separate parameters can make things a
  8. // bit easier to read...but do incur a small amount of overhead.
  9. // I chose to serialize your payload data inline (as opposed to storing in
  10. // a separate variable), but it really doesn't make any difference.
  11. // Use whatever you're more comfortable with (again, _be consistent_)
  12. SendGridAPI.sendRequest(json.serialize(listmaker.get(username)),
  13. '/v3/contactdb/lists/' + sendSetting.list_id__c + '/recipients',
  14. 'POST');
  15. }
  16. else{
  17. string usernames = 'Roger';
  18. sendgridsettings__c sendSetting = sendgridsettings__c.getInstance(usernames);
  19. system.debug(sendSetting);
  20.  
  21. // Storing parameters to a call as separate parameters can make things a
  22. // bit easier to read...but do incur a small amount of overhead.
  23. // I chose to serialize your payload data inline (as opposed to storing in
  24. // a separate variable), but it really doesn't make any difference.
  25. // Use whatever you're more comfortable with (again, _be consistent_)
  26. SendGridAPI.sendRequest(json.serialize(listmaker.get(usernames)),
  27. '/v3/contactdb/lists/' + sendSetting.list_id__c + '/recipients',
  28. 'POST');
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement