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
0
votes
1answer
25 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 ...
1
vote
1answer
75 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 ...
0
votes
1answer
26 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 ...
0
votes
1answer
29 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 ...
0
votes
1answer
43 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 ...
1
vote
1answer
90 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'...
-2
votes
1answer
32 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
0
votes
3answers
77 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() { ...
2
votes
1answer
86 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 ...
2
votes
1answer
70 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 ...
1
vote
1answer
99 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 ...
1
vote
1answer
29 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 ...
1
vote
0answers
35 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 ...
0
votes
1answer
44 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 ...
3
votes
1answer
269 views

Pass a Collection Variable to Apex Action in Record Trigger Flow

I'm trying to pass a collection variable of opportunities from a flow to apex. Here is my apex and a picture of my action element. Why can't I pass my collection of opportunities (socOpportunity in my ...
0
votes
2answers
68 views

Update a record in future method with JSON data [closed]

From process builder getting record id and pass that in to apex. Apex class to update the record: public class BacktoQuantum { @InvocableMethod(label='getdata' description='Get data ...
0
votes
0answers
21 views

Writing a test class for an invocable method that combines the UTC dates of the beginning of the year and the current time [duplicate]

I built an apex class for an invocable method that runs from a flow to generate a link to authenticate a user to a community. The apex class updates a field on the contact record when the contact (a ...
0
votes
0answers
36 views

Correct method to call invocableMethod from Flow

I have a created an invocableMethod that takes in a list of Work Orders public class UpdateToAddressOnWorkOrderFromOrder { @InvocableMethod(label='update workorder ToAddress') public static ...
0
votes
1answer
33 views

How to pass key from an apex class to Visualforce controller class?

I have created a process builder which invokes apex class when a checkbox is true and it adds the encrypted Id and encrypted key to the fields in opportunity records. The issue is that when I am ...
0
votes
3answers
60 views

Multiple callout from future that is called from an InvocableMethod

I am having some difficulties to call multiple callouts from a future method which is calling from a Process Builder. I am getting the below error, System.CalloutException: You have uncommitted work ...
1
vote
1answer
110 views

Returning a value from invoked callout method but keep getting CalloutException

Im trying to make a callout when an opportunity reaches a stage and from this callout update a field. I created this apex class which is called from a flow. But I keep getting You have uncommitted ...
0
votes
2answers
74 views

Invocable Sobject Class Returning Number of Results Does Not Match

I have resolved this error in the past when the input is more records than the output (i.e. sending 10 recordIds and returning a single List) however, here I am getting error for autolaunched flow ...
1
vote
0answers
40 views

RecentlyViewed causes non-selective query error when run from a screen flow

I have a screen flow that calls an invocable apex method containing the query: List<RecentlyViewed> viewedRecords = [SELECT Id , Name , Type , LastViewedDate FROM RecentlyViewed WHERE ...
1
vote
1answer
54 views

Database.Query does not return fields with null value - Reasking

This was asked previously here however the answer isnt useful. Using an invocable class with a dynamic database query. If any of the fields in the query return a null value then the field is dropped ...
1
vote
1answer
138 views

Process.Plugin to Invocable Method in the Apex Classes

We are currently using the Apex Class with Process.Plugin that is refered here in the article https://developer.salesforce.com/blogs/developer-relations/2012/03/visual-workflow-converting-leads-with-...
0
votes
1answer
32 views

Need to update a record, Is making a new instance with known Id a safe alternative to SOQL'ing?

Invocable method gets readonly accounts from PB, which need to be re-instantiated before updating, here's a solution I tried and it works: @InvocableMethod(label='methodname') public ...
0
votes
2answers
437 views

How - Call invocable Apex class that returns me a list of ids, in flow builder

I have an invocable Apex class that returns me a list of ids. But when I create an apex action at the level of my flow builder, I cannot store the list in a collection variable, it just offers me a ...
0
votes
1answer
57 views

Get flow name in Invocable Method

is it possible to get a flow name that invoked the invocable method in Apex? Basically, I want to implement the getFlowName method that dynamically returns a flow name that invoked this method. @...
0
votes
0answers
79 views

Debugging Process Builder and Scheduled Actions that invoke Apex

Im not finding much online for this issue so Im hoping someone here can help us. We have a process builder that sends out 30, 60, and 90 email reminders to our customers after the date an initial ...
2
votes
0answers
35 views

System.CalloutException: Callout loop not allowed when doing callout from Scheduled Flow

I am currently having an issue where my Callouts are returning an error: System.CalloutException: Callout loop not allowed The way the system works is this: I have a scheduled job that runs every ...
0
votes
0answers
108 views

Passing a null value to an invocable through flow

I currently have a flow that calls an invocable method in order to perform a callout. From the flow, I pass in several arguments to the invocable method. However, sometimes, these arguments can be ...
1
vote
0answers
37 views

Flow & Apex(@Invocable method) : Identify the primary input variable

I would like to know if there is a way using service/object (like using Metadata api service) to identify primary parameter in a flow & apex method(@invocable method). Among multiple input ...
1
vote
2answers
259 views

Flow doesn't invoke assignment rules via apex

I seem to have found some strange behavior in the Flow tool. I've created a flow that does some record queries/updates, and then invokes the below class: public class LeadAssignInvocable { @...
0
votes
0answers
122 views

Call a @Future method with the Process Builder

I am attempting to call a class with a @Future method by using Process Builder. In order to do this I believe I need to initially call a class with an @InvocableMethod to in-turn call that @Future ...
0
votes
2answers
557 views

Invoke Apex Class with Process Builder

I am attempting to start this Apex class with Process Builder, triggered by a field change. I've never done this before and I'm unsure what invoke code needs to be added in order to accomplish this. I ...
2
votes
0answers
19 views

What is the sharing mode for a class that inherits the sharing model of its caller in a flow?

What happens if a class that uses the inherited sharing sharing model is also a class that is a custom Apex action used in a screen flow? If the flow's "How to Run the Flow" is set to "...
2
votes
2answers
554 views

Bulkification of Flow with invocable action - error re: number of results - how do I resolve?

I'm getting the error "The number of results does not match the number of interviews that were executed in a single bulk execution request" when I insert more than one record into an object ...
5
votes
2answers
151 views

Can Apex static values be used to safely communicate between executions of process builder?

We have a Process Builder which currently gets a hardcoded Salesforce Id out of an abused label and assigns it to the record. Of course, this means the solution causes tests to fail outside ...
0
votes
0answers
62 views

Flow passing in record with multipicklist value into Invocable Apex method causes error

I want to pass records prepared into an Invocable Apex method from a flow that have had picklist and multipicklist values set on the record. I want to insert a record from Flow via apex (using ...
0
votes
3answers
686 views

Flow Invocable Apex - FLOW_ELEMENT_ERROR The number of results does not match

I'm trying to use invocable apex within a record triggered flow to create a static flag to ensure that code only runs once for each transaction. When I update more than one record I'm getting error: ...
1
vote
0answers
64 views

UserRecordAccess query not returning any results

I am calling a apex method from lightning flow. Inside method, I am trying to query UserRecordAccess as below : SELECT RecordId, HasReadAccess FROM UserRecordAccess WHERE UserId=:'005xxxxxxxxxxxxxx' ...
2
votes
1answer
47 views

How can I fix error “InvocableMethod methods must be in version 33 or higher”?

I tried to get a value from flow. This is my code which cause error "InvocableMethod methods must be in version 33 or higher": @InvocableMethod public static List<List<Opportunity>&...
1
vote
1answer
968 views

Receiving “Profile does not have access to” in the flow when calling invocable apex class

I have a flow that calls an invocable action from apex class. It accepts a list of required parameters and the flow has been working for the last 2 years. And then something happened and the flow ...
1
vote
0answers
192 views

Einstein Bot - Passing boolean into Apex action

I need to pass boolean value (NOT asked to the customer) to apex action and need to hard code it. I have an invocable method which takes a list parameters like (psuedo code) public class SomeClass{ @...
0
votes
1answer
42 views

Use invocable method on the MergeCaseController, error that i will not be able to use the invocable method on a constructor. thank you

I am trying to use the invocable method on Public MergeCaseController(ApexPages.StandardsetController controller) so that i can call this from a flow.. But i am having issues doing so, public ...
0
votes
1answer
23 views

Removing @InvocableMethod from a referenced method in ProcessBuilder changes the ProcessBuilder

Basically the title explains everything. I had a process builder calling an invocable method in apex. I updated the class to remove the invocableMethod annotation and the proccesss builder action has ...
0
votes
2answers
489 views

Creating an invocable apex class sending email with optional send from

I am trying to set up an invocable apex class to send an email to a contact with merge fields from other record ID types with an optional variable to set the sender. I have looked at this question for ...
0
votes
2answers
846 views

Batch Apex vs Queueable

Thanks to another user (sfdcfox) I've got the following queueable apex being invoked via a screen flow that's being used to update account records. It's taking two string variables from the flow and ...
1
vote
2answers
464 views

Flow with invocable apex

Apex beginner here so I'm open to any and all suggestions. I'm working on a flow + invocable apex combination to mass reassign records. Basically trying to take variables obtained by the flow and ...
0
votes
1answer
157 views

@InvocableVariables in Apex test class

I am having difficulty writing tests for the apex class. This is my first time working with apex classes and I don't understand how to send to @InvocableVariable. I've read answers to similar ...