Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public class oppTrigClass {
  2. public class oppRecord {
  3. public string oppId {get;set;}
  4. public string ownerId{get;set;}
  5. public date cDate{get;set;}
  6. public string stage{get;set;}
  7. }
  8. //
  9. @future(callout = true)
  10. public static void postOppInfo(list<Id> oppIds){
  11. //Create JSON generator
  12. JSONGenerator gen = JSON.createGenerator(true);
  13. gen.writeStartArray();
  14. for(Id oppId : oppIds){
  15. gen.writeStartObject();
  16. gen.writeStringField('Opportunity id', oppId);
  17. gen.writeStringField('Stage', oppId.StageName);
  18. //gen.writeStringField('owner id', oppId.ownerId);
  19. //gen.writeDateField('close date', oppId.cDate);
  20. gen.writeEndObject();
  21. }
  22. gen.writeEndArray();
  23. string jsonOpps = gen.getAsString();
  24. system.debug('Opportunities:' + jsonOpps);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement