2022 Developer Survey is open! Take survey.

Questions tagged [invocable-method]

Invocable methods in Apex are called as invocable actions by the REST API and require the InvocableMethod annotation as an identifier. This can only be applied to one method in class and takes a maximum of 1 input parameter of a list of either a primitive data type, an sObject type or a user defined type.

Filter by
Sorted by
Tagged with
1 vote
2 answers
86 views
+100

Flow InvocableAction returning an object with a list of objects

I'm looking to provide a Flow User with a list of Search Results based on a query. I have the following set of code, and haven't been able to figure out how to get it to work. (I've tried moving the ...
user avatar
1 vote
1 answer
47 views

The number of results does not match the number of interviews that were executed in a single bulk execution request

I'm getting this error when I insert more than one record into an custom object that has a record-triggered Flow. Flow calls an invocable method to do parse multipicklist values. here's my invocable ...
user avatar
0 votes
0 answers
40 views

External callout using Flow Builder - Apex Class Invocable Action

I would like to create a callout (webhook) when a custom field Batch_Name__c is updated which belongs to the Account Object. The purpose of this callout is to send all account information to an ...
user avatar
  • 1
0 votes
1 answer
47 views

Flow using @InvocableMethod fails when inserting multiple records

I have an Apex class that matches Lead records to existing Contact records based on a phone number input. I'm using @InvocableMethod to include it in a Flow. The Flow works as designed when I insert a ...
user avatar
  • 5
0 votes
1 answer
20 views

Flow executes only the first apex method

My flow which runs the apex code below just execute the first method. Is something missing to execute also the second method? public without sharing class MonthlyReport4FDB{ @InvocableMethod(...
user avatar
  • 83
0 votes
1 answer
117 views

How can I pass maps to an Invocable Method?

I have a method in my code that I want to make into an invocable method: // This should be an invocable method with @InvocableMethod private void updateContacts(Map<Id,Contact> newContactMap, ...
user avatar
  • 129
0 votes
2 answers
45 views

QueryException when using Invocable Method and SOQL

We have a flow that presents a multi-picklist on a screen that presents related Accounts. We then want to create a related object on each of those selected Accounts. To allow for modularity, we want ...
user avatar
  • 77
-3 votes
1 answer
26 views

I am not getting full code coverage in my test class, is it because test data isn't setup correctly?

I'm new to Apex and have been working on a class as a training excersize. The invocable method works as expected when called from a flow but I'm having trouble getting the proper code coverage. I ...
user avatar
  • 31
1 vote
1 answer
41 views

I need help resolving "unexpected token" error when setting up invocable variables in a test class

I have an invocable method with varables. I am stuck how to set these in a test class, below is the progress I've made. I am getting an errror "Unexpected token '='" on the last couple lines ...
user avatar
  • 31
1 vote
1 answer
86 views

Invocable apex REST POST

I'm an admin who pretends to be a developer every once in awhile. I'm trying to use a Flow to initiate a REST POST callout. From other research, I understand this may need to be done with a future ...
user avatar
  • 11
-3 votes
1 answer
41 views

How do you write test of Invocable Class?

I am calling this class from Flow to loop through picklist values inside the Position Picklist field. I am stuck at 53% coverage for my test class. The section between two == in the class is not ...
user avatar
  • 13
-2 votes
1 answer
32 views

convert list with duplicate id to Map

I am working on an apex which is used to clear Hierarchy field values on User records when a user is deactivated. I am stuck at the last part of code. I have a List with same UserID but with different ...
user avatar
-3 votes
1 answer
62 views

Test Class for an existing Apex Class

Apex Class public class DistanceRecord { public class FlowInputs { @invocableVariable public String AccountId; } @InvocableMethod public static void getAcct(List<FlowInputs&...
user avatar
  • 1
1 vote
1 answer
598 views

Calling Future Method From Trigger

I am pretty stumped - I have a trigger on a custom object that calls a helper class that calls a future callout method. When I call the trigger, the helper class is called but I can't seem to get into ...
user avatar
  • 3,177
0 votes
1 answer
407 views

How to iterate over List<List<String>> which is returned by Apex, in a flow?

I am invoking an apex class in my flow, which returns List<List< String>> back to the main flow. The flow surprisingly doesn't let me store the returned value in a collection variable. Now ...
user avatar
2 votes
0 answers
108 views

Should an Apex class of utility methods which are invocable from Flows be implemented in the real world?

As I implied in a recent question, I know just enough Apex to be dangerous when trying to implement more complex concepts. (And by "complex" I mean "complex to me" because so many ...
user avatar
  • 2,060
0 votes
1 answer
42 views

Is it possible to create a REUSABLE invocable method for serializing Apex Defined Variables (Wrappers) to be used in flows?

Edit: I've tried this by creating virtual/abstract class and setting it as the parameter for the invocable and then made an extension and passed it from the flow. Flow doesn't seem to allow this, it ...
user avatar
  • 273
0 votes
1 answer
47 views

Invalid character in identifier: objProject_Contacts__c

I am trying to write an Apex class that will send emails to my project contacts. Still, I do face one error. I am not sure what I am doing wrong cause I am a beginner in Apex. public class ...
user avatar
  • 3
0 votes
0 answers
52 views

How do I access the Collection Values within a Flow that are the result of an Apex Action Output value?

Hi I've added an Apex Action element to my flow which includes an output value. The Apex Action only returns one record but I understand it has to be returned as a nested list. The output value is a ...
user avatar
0 votes
1 answer
182 views

Unable to Save a Flow that contains Invokable Apex action

Getting "Something went wrong. Hmm, that didn't work. Please try again." error while saving the screen flow that contains Invokable Apex action. Recently I did a modification on the apex ...
user avatar
0 votes
1 answer
127 views

Can We Use Generic SObject With Custom MetaData Types getAll For Invocable Flow

We have an Invocable Apex Class to do SOQL which uses generic SObject in flow but returns an error the same if trying to use that Sobject for the Custom Metadata getAll method. global with sharing ...
user avatar
  • 1,436
0 votes
1 answer
46 views

Invocable variable set default value

Is it possible to set default value for invocable variable? Didnt find any info. @InvocableVariable(Label='Var' Required=true) public String var = 'var';
user avatar
1 vote
1 answer
97 views

Is There A Way To Pass Variable From Flow To Invocable Apex SOQL String

I'm using a very basic Apex Invocable Class from UnofficalSf to create SOQL queries from Flow and trying to see if there is any way I can pass one of the flow variables, such as {!vaname} or even ...
user avatar
  • 1,436
0 votes
1 answer
64 views

Error on flow execution - The number of results does not match the number of interviews that were executed

I have a simple flow which is triggered from PB on record create. Thw flow is calling to Invocable Apex class in order to calculate business days and than - update the record. The process works just ...
user avatar
  • 139
1 vote
0 answers
38 views

Getting Error while calling invokable method from Einstein Bot

I am getting this error in the log when calling an invocable method from Einstein Bot. Error: Attribute lookup failed for invocable action WorkflowValidateHelper at path /support/conversations/...
user avatar
  • 11
0 votes
1 answer
49 views

Invocable Apex to compare 2 collections and get unique elements

We have a flow that loops through 2 objects (User & Email message) and stores its email addresses in 2 collections (Co11 and col2). I want to compare 2 collections and get unique elements before i ...
user avatar
  • 55
0 votes
2 answers
57 views

Invocable Method + Variables -- Hitting Null Pointer Exception

I'm hitting a null pointer exception on an Invocable Method that I'm working on. I suspect that this is happening in the runClass method when I'm trying to convert my List of user ids ("userIds&...
user avatar
0 votes
1 answer
65 views

How to convert List<sObject> to List<InnerClass>

I have a @InvocableMethod that is used from Flow builder to create a record. Also I have a inner class with @invocableVariable. It is working fine, but I want to use the same method from another class ...
user avatar
  • 5
0 votes
0 answers
90 views

How to pass List<sObject> to @InvocableMethod that accepts only @InvocableVariable [duplicate]

I have a @InvocableMethod that is used from Flow builder to create a record. Also I have a inner class with @invocableVariable. It is working fine, but I want to use the same method to create records ...
user avatar
  • 5
0 votes
0 answers
40 views

Generating a CSV through a report inside an invocable method THROWS exception, but in a normal method it doesn't!

I am trying to generate a CSV through an InvocableMethod but it throws an exception. If the same code runs in a normal method, then no exception is thrown. In the following code for example sendEmail2 ...
user avatar
0 votes
0 answers
88 views

Test class for Invocable Method from Flow

I have been banging my head against the wall trying to work out how to write a test class that gets any coverage for this method, which takes values from a screenflow and returns a value back to the ...
user avatar
3 votes
0 answers
183 views

Scheduled Flow Not Running for All Records

I am hoping someone can help me with Schedule-Triggered Flows (STF). I have created a STF that gets all leads matching a specific criteria. The flow then checks the record type of the lead. If (Record ...
user avatar
-1 votes
1 answer
220 views

Invocable method with wrapper parameter in console

I have invocable method and trying to pass wrapper as parameter. But i wanna run that in console. How can i do it? It gives me error wrong parameter when i am trying to pass Wrapper Object. public ...
user avatar
0 votes
0 answers
281 views

Test Class on Approval Action Apex Class

I have an Invocable apex class for approval actions. I am trying to get test coverage on this. But I must be missing something as there are no lines of code coverage. I am new to apex so its ...
user avatar
0 votes
1 answer
91 views

How to properly test invocable callout class

I am a total beginner in Apex, however I created the following class that calls an external API endpoint and is invoked by a flow: public class SubscribeToStatuspage { @InvocableMethod(label='Call ...
user avatar
2 votes
1 answer
3k views

Passing variables from flow to apex and then from apex to flow

I'm trying to put in place a screen flow component in order to display knowledge articles based on the case fields and Knowledge-articles data category. In order to do so, I've created an apex class ...
user avatar
0 votes
1 answer
188 views

Pass values back to flow

I am brand new to Apex, this is my first attempt - I adapted some code from here which is working, but ideally, I'd like to pass the urlencoded variable back to the flow, however, I can't work out how ...
user avatar
  • 3
1 vote
1 answer
172 views

Variable does not exist: Interview - when calling Flow.Interview

I am creating a method that will call multiple flows. However I am receiving the following error - Variable does not exist: Interview. I have tried using both static and non static to no avail. Below ...
user avatar
0 votes
1 answer
235 views

Unable to use @future(callout=true) method in Apex class

1.Currently working on Apex with the flow to pass the API data. 2.If I use @future(callout=true) in apex it throws an error like below. Error: The only annotation that can be used with ...
user avatar
1 vote
1 answer
138 views

Invocable Apex in Flows and Custom Metadata SOQL limits?

Say we have a record-triggered flow that calls invocable Apex. The Apex class uses SOQL to query custom metadata and return a value to the flow. Does the Apex custom metadata query count against the ...
user avatar
  • 6,320
0 votes
1 answer
369 views

Flow Variable of Email addresses to Invocable Apex action

I'm trying to pass in the flow variable collection of Email addresses to Apex action to send out one email to each email address. I got some idea from Question, the code works fine when i ran it from ...
user avatar
  • 55
1 vote
1 answer
820 views

Invoke Apex to send email from Flow

We have a flow that stores the collection of Ids with Email address and we want to pass those Ids to send an email from Apex. I'm Trying to call the apex but it gives me error list has no rows. Couldn'...
user avatar
  • 55
-2 votes
1 answer
356 views

create @InvocableMethod inside class that implemented Batchable and invoke new instance to start

the main idea is to invoke @invocableMethod from flow and start Batch without creating separate class to be able to start batch
user avatar
  • 687
0 votes
3 answers
1k views

Can't I return a wrapper class for invocable method?

I'm writing an Apex Invocable method that should return a wrapper class data and my code is as below. @InvocableMethod global static List<List<prodWrap>> getProducts() { ...
user avatar
2 votes
1 answer
540 views

How to debug a @InvocableMethod

I am making a Einstein Bot that call an Apex class. The input is working but the output is empty and i can't understand the reason. I don't see the results of "System.debug()" methods in ...
user avatar
2 votes
1 answer
326 views

I am getting DML Limit exception in Flow without using any DML statements

I have a flow that generates an encrypted token for new Campaign Member records. This works perfectly fine for creating one record at a time. When I try to create 188 campaign members I get error An ...
user avatar
2 votes
1 answer
820 views

Messaging.sendEmail not sending emails for non-admin profile in sandbox

In a partial sandbox I am calling Messaging.sendEmail through an @InvocableMethod through a Flow, and emails are not going out for a non-admin profile. There are no errors anywhere and even debugging ...
user avatar
  • 3,764
1 vote
1 answer
667 views

InvocableMethod - returning string value back to the flow

I want to return a string value back to the flow. Got it this far, and also I am able to get the return value when I am not in an invocable method. Here is the error I am getting - Method does not ...
user avatar
  • 491
1 vote
0 answers
45 views

Newbie needing help writing a test class for an invocable method

With a lot of help from this forum and the developer forum, I got my first invocable method to work but now I am stuck on writing the test class for it. Here's my invocable method and the attempt at a ...
user avatar
0 votes
1 answer
72 views

Only one parameter is support on methods with @invocablem

I need to update status values to the custom object Loan application so used apex class and to call in process builder it caused an error Error:**Only one parameter is supported on methods with can ...
user avatar

1
2 3 4 5