• David Gunn 17
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
(If should be posted to the developers forum I apologize - let me know and I'll post there instead.)

I can't set up my flow to receive a return value from an invocablemethod. :(

I'm building an Apex class named Temp that contains an invocablemethod named performApproval.  It returns a return code and string message through a custom object:
global without sharing class Temp {
	
    @InvocableMethod
    public static List<Apex_Result__c> performApproval(List<MyInvocableVariables> myVariablesList) {
		List<Apex_Result__c> resultList = new List<Apex_Result__c>();
		Apex_Result__c result = new Apex_Result__c();
		result.Return_Code__c = 1;
		result.Message__c = 'Testing';    	
		resultList.Add(result);
		return resultList;
	}

	global class MyInvocableVariables {
		@InvocableVariable(label='Opp ID' required=true) 
		global Id oppID; 		
	}
}
I call the method from a flow, and I defined an SObject collection variable named Results to receive the results of the call. However, when I attempt to specify that the method's output should go into that variable I only get the option to create a new variable:

Screenshot showing I only see Create New

Can anyone explain why I can't select an existing variable?  Even if I create a new variable it doesn't use it or allow me to select it.
I have a new class that I'm trying to save but I'm getting this error: Error:

Compile Error: Variable does not exist: CreatedDate at line 25 column 27

This is where it's getting tripped up:
DateTime myDate = taskList[0].CreatedDate;
taskList is a list of (passed in from a trigger) tasks.  CreatedDate is a standard task field.  Why is it getting a "variable does not exist" error?
 
I'm taking one of the beginner admin modules about Setup; on the page (https://trailhead.salesforce.com/force_com_admin_beginner/starting_force_com/starting_tour) there is a video tour of Setup but when I click on it to play it it says I need to login first.  I am logged into Trailhead as well as into my personal org.  What am I missing?
(If should be posted to the developers forum I apologize - let me know and I'll post there instead.)

I can't set up my flow to receive a return value from an invocablemethod. :(

I'm building an Apex class named Temp that contains an invocablemethod named performApproval.  It returns a return code and string message through a custom object:
global without sharing class Temp {
	
    @InvocableMethod
    public static List<Apex_Result__c> performApproval(List<MyInvocableVariables> myVariablesList) {
		List<Apex_Result__c> resultList = new List<Apex_Result__c>();
		Apex_Result__c result = new Apex_Result__c();
		result.Return_Code__c = 1;
		result.Message__c = 'Testing';    	
		resultList.Add(result);
		return resultList;
	}

	global class MyInvocableVariables {
		@InvocableVariable(label='Opp ID' required=true) 
		global Id oppID; 		
	}
}
I call the method from a flow, and I defined an SObject collection variable named Results to receive the results of the call. However, when I attempt to specify that the method's output should go into that variable I only get the option to create a new variable:

Screenshot showing I only see Create New

Can anyone explain why I can't select an existing variable?  Even if I create a new variable it doesn't use it or allow me to select it.
I have a new class that I'm trying to save but I'm getting this error: Error:

Compile Error: Variable does not exist: CreatedDate at line 25 column 27

This is where it's getting tripped up:
DateTime myDate = taskList[0].CreatedDate;
taskList is a list of (passed in from a trigger) tasks.  CreatedDate is a standard task field.  Why is it getting a "variable does not exist" error?