September 11, 2020

Salesforce Scheduled Flow

 
1. It runs as Automated Process User. So, use Automated Process User in Debug Logs.
 

 2. When calling Apex Class, it is bulkified.

Sample Code:

global class FlowSchedule {
    
    @InvocableMethod( label='Show Outputs' description='Getting multiple values' )
    global static List < FlowOutput > showOutputs( List < FlowInput > inputs ) {
        
        FlowInput objInput = inputs.get( 0 );
        List < FlowOutput > outputs = new List < FlowOutput >();
        for ( FlowInput inp : inputs ) {
            FlowOutput objOutput = new FlowOutput();
            objOutput.str3 = objInput.str1;
            objOutput.str4 = objInput.str2;
            outputs.add ( objOutput );
        }
        system.debug( 'outputs size is ' + outputs.size() );
        system.debug( 'outputs are ' + outputs );
        return outputs;
        
    }
    
    global class FlowInput {
        
        @InvocableVariable
        global String str1;
        
        @InvocableVariable
        global String str2;
        
    }
    
    global class FlowOutput {
        
        @InvocableVariable
        global String str3;
        
        @InvocableVariable
        global String str4;
        
    }
    
}
 
 
 


No comments:

Post a Comment