You need to sign in to do that
Don't have an account?
ccazz
Invocable Variable not recognized
I am trying to do the following:
Call Apex from a Process or Flow (Invocable Method),
Make an HTTP Callout (can't do this from invocable method so using a queueable class)
I have been using these examples to write the code related to invocable variables:
1. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableVariable.htm
2. https://developer.salesforce.com/forums/?id=9060G0000005nusQAA
Here is what I have:
public class EnqueueCallout {
@InvocableMethod(label='Enroll in XYZ Program' )
public static void queueCallout(List<FlowInputs> calloutvars) {
string card = calloutvars.cardnum;
string offer = calloutvars.offerid;
//this calls the queueable class and sends the variables...this part works fine when using the execute command in the execute anonymous apex window.
ID jobID = System.enqueueJob(new SendCallout(card, offer));
}
//input details that come into apex from flow
public class FlowInputs {
@InvocableVariable(required=true)
public string cardnum;
@InvocableVariable(required=true)
public string offerid;
}
}
but I am getting the error "Error: Compile Error: Variable does not exist: cardnum at line 5 column 35"
Call Apex from a Process or Flow (Invocable Method),
Make an HTTP Callout (can't do this from invocable method so using a queueable class)
I have been using these examples to write the code related to invocable variables:
1. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableVariable.htm
2. https://developer.salesforce.com/forums/?id=9060G0000005nusQAA
Here is what I have:
public class EnqueueCallout {
@InvocableMethod(label='Enroll in XYZ Program' )
public static void queueCallout(List<FlowInputs> calloutvars) {
string card = calloutvars.cardnum;
string offer = calloutvars.offerid;
//this calls the queueable class and sends the variables...this part works fine when using the execute command in the execute anonymous apex window.
ID jobID = System.enqueueJob(new SendCallout(card, offer));
}
//input details that come into apex from flow
public class FlowInputs {
@InvocableVariable(required=true)
public string cardnum;
@InvocableVariable(required=true)
public string offerid;
}
}
but I am getting the error "Error: Compile Error: Variable does not exist: cardnum at line 5 column 35"
Use this:
OR, iterate "calloutvars" in for each loop.
All Answers
Use this:
OR, iterate "calloutvars" in for each loop.