3

I Want to set output values in flow from apex action.

Below mentioned im getting oppId as input values from apex class.

public class flowinputs{
            @invocableVariable public String oppId;
           }

enter image description here

But Store Output Values not showing my apex results class Quoteids, QuoteSums.

This sample pic from google Same(result in setoutputvalues) like this i want to see in my Action, in order to store the output value (in my case the Results are Quoteids,QuoteSums): enter image description here

Please refer the below screenshot like this i want.

See below image output values not showing from apex class result Quoteids, QuoteSums. In set ouput values i can't able to declare new resources also. enter image description here

In Flow Debug im getting my results but im not able to assign output values enter image description here

Here is apex code, Im getting results, I need to get setoutputvalues from apex as collection variable.

    public class checksum {
    public class flowinputs{
            @invocableVariable public String oppId;
           
    }
    public class results{
            @invocableVariable public Decimal Quotesum;
        public results(Decimal Quotesums){this.Quotesum=Quotesums;}
          @invocableVariable public string Quoteid;
        public results(string Quoteids){this.Quoteid=Quoteid;}
        
    }
@invocableMethod
    public static list<list<results>> countSum(list<flowinputs> requests){
        list<list<results>> usd =new list<list<results>>();
        list<results> ussd=new list<results>();
        usd.add(ussd);
        List<id> oppids = new list<Id>();       
        for(flowinputs request:requests)
        {
            oppids.add(request.oppId);
            
        }
        for(AggregateResult Qsum: [select SBQQ__Quote__r.id quoteid,SBQQ__Product__r.id prid,sum(SBQQ__Quantity__c) qunty from SBQQ__QuoteLine__c where SBQQ__Quote__r.id=: oppids group by SBQQ__Product__r.id,SBQQ__Quote__r.id]){
           String accid =(String)Qsum.get('quoteid');
            String acid =(String)Qsum.get('prid');
            Decimal quotesums=(Decimal)Qsum.get('qunty');
           // System.debug('accid' +accid);
            System.debug('sum'+quotesums);
            ussd.add(new results(quotesums));
              ussd.add(new results(acid));
            ussd.add(new results(accid));
        }
            
return usd;
    }
    
}
2
  • 1
    Typo? public results(string Quoteids){this.Quoteid=Quoteid;} You should also name your inner class results to Result as it contains only scalars, not collections
    – cropredy
    Commented Jul 12, 2021 at 16:32
  • 1
    Look at the below link. developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… Your results class doesn't look the same as theirs, probably try to mimic that more closely? One thing I notice that seems important is after they @invocableVariable they have parenthesis around their definitions where you do not (in their second example). And then when they define the variable, they do it much more cleanly "public SObject outputMember" where you have extra stuff. Also it looks like you named both outputs "results" Commented Jul 13, 2021 at 17:39

0

You must log in to answer this question.

Browse other questions tagged .