+ Start a Discussion
Adelchi PelizzoAdelchi Pelizzo 

Json parser for InvocableMethod in Flow

I want to show two fields value in a flow screen, but at the moment it gives me null. I use an Invocable method to retrieve a json file, indetify and store only those two values in a subclass containing two invocablevariable. After executing it in dev console, I can print out in system.debug at line 21 and 26 but not at line 33.
global class par{
@InvocableMethod(label='Get Map' description='Returns the values of Maps')
    global static List<adel.par.VarWrap> CallMap(){
        List<adel.par.VarWrap> wraps = new List<adel.par.VarWrap>();
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HTTPResponse res = http.send(req);
        JSONParser parser = JSON.createParser(res.getBody());
        while (parser.nextToken()!= null)
            adel.par.VarWrap wrap = new adel.par.VarWrap();
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME)
                string fieldName = parser.getText();
                if(fieldName == 'place_id')
                    wrap.placeRet = parser.getText();
                }else if(fieldName == 'status')
                    wrap.statusRet = parser.getText();
        return wraps;  
    global class VarWrap{
        public String placeRet;
        public String statusRet;       
I understand InvocableMethods can return only lists. It would work if the sObject VarWrap contained only one field value.