Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class oppTrigClass {
- public class oppRecord {
- public string oppId {get;set;}
- public string ownerId{get;set;}
- public date cDate{get;set;}
- public string stage{get;set;}
- }
- //
- @future(callout = true)
- public static void postOppInfo(list<Id> oppIds){
- //Create JSON generator
- JSONGenerator gen = JSON.createGenerator(true);
- gen.writeStartArray();
- for(Id oppId : oppIds){
- gen.writeStartObject();
- gen.writeStringField('Opportunity id', oppId);
- gen.writeStringField('Stage', oppId.StageName);
- //gen.writeStringField('owner id', oppId.ownerId);
- //gen.writeDateField('close date', oppId.cDate);
- gen.writeEndObject();
- }
- gen.writeEndArray();
- string jsonOpps = gen.getAsString();
- system.debug('Opportunities:' + jsonOpps);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement