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
0 answers
27 views

. Can't perform callout when resuming a flow or inside an Apex Queueable

Currently, I've setup a scheduled flow to make an external callout. If i debug manually it's working successfully because it's firing for a single record. But if i scheduled the flow I'm getting below ...
Pavan tej's user avatar
  • 1,429
1 vote
1 answer
67 views

batch vs queueable for pseudobulkification of an app

I'm testing out an app that uses a callout to check some info in a government database and writes back any hits to a custom object. The app is designed to be used via an action on a record page, but I ...
gorav's user avatar
  • 4,465
1 vote
1 answer
39 views

New to apex "Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request

I am trying to return the email and id from a report inside of an apex flow using the following code. The flow sends 1 report id to the apex class. I keep getting back "Error Occurred: The number ...
val3ri3's user avatar
  • 15
0 votes
1 answer
51 views

Invocable Method to return External Service data type

Ideally, we will create an External Service based on the API Schema and use it in Flows. For some reason, when we do callouts in the Flow, the API cannot parse the Authorization header correctly, ...
codefish's user avatar
0 votes
1 answer
39 views

Invocable method icon not visible

I defined an invocable method with an SLDS icon like this: @InvocableMethod(Label='Clone Opportunity' IconName='slds:action:clone') Today I noticed that the SLDS icon is not displayed in the Flow ...
Semmel's user avatar
  • 2,250
0 votes
1 answer
47 views

How to name invocable classes? [closed]

By design, a class can only have one invocable method - which is very different from the way you could design classes containing web service methods (where you could have multiple exposed methods). ...
Semmel's user avatar
  • 2,250
0 votes
3 answers
69 views

How does bulkification work for records in an invocable action in a flow?

If I have an invocable method that is bulkified to handle multiple records updated in a single transaction, what is the most efficient way to write the Flow that calls it? My initial Flow design lets ...
AlwaysThinkin's user avatar
0 votes
2 answers
84 views

Managed package Flow actions in profession edition

I've a managed package that includes several flow actions(Invocable methods). In Enterprise edition, they're available in flow builder, however in professional edition they're not. I have confirmed in ...
vishesh's user avatar
  • 803
0 votes
0 answers
33 views

Why do annotation parameters not use a comma as separator?

Looking at the official documentation for the annotation InvocableMethod we can see that the parameters - unlike other languages I know - do not use a comma as a separator for the parameters. Any ...
Semmel's user avatar
  • 2,250
1 vote
1 answer
32 views

My LWC doesn't output the right format to be picked up in my Apex parser

I have a LWC which outputs a list of Line Items. Here is createInvoiceLineItems.html: <template> <lightning-card title="Invoice Line Items"> <template for:each={...
Luke Bray's user avatar
  • 506
1 vote
2 answers
189 views

Invocable Method - how do you return a value from an invocable with no input parameters?

Normally, with an invocable method, you'd do something to the effect of: public static List<Output> invoke(List<Input> inputs) { List<Output> outputs = new List<Output>(); ...
SarcasticSully's user avatar
0 votes
1 answer
51 views

Copy Field Values to a different Record Type

We need to keep an audit of all field changes for a Custom Object, Work Experience. I have created a separate child Object, Work Experience Audit, which has all of the same editable fields. I have ...
Jeff Callahan's user avatar
0 votes
1 answer
30 views

Flow Interview variables in invokable action

I've created an invocable apex action to be used in the flow builder. When the flow runs, is there a way for me to get the flow interview id in my invocable apex method? I don't want the user to pass ...
vishesh's user avatar
  • 803
0 votes
0 answers
45 views

Apex Clone trying to write to a non writeable field on the Asset Object

First time posting and pretty new to writing APEX (thanks ChatGPT). In Sandbox, I have written an invocable class, based on a collection of assets being passed in too clone and a certain number of ...
MelHarrison's user avatar
0 votes
2 answers
426 views

Invocable Actions - Calling Flow from Apex with bulk data

I'm evaluating Mitch Spano's trigger framework that includes the ability to invoke Flows alongside Apex actions (with neat features for ordering, bypassing, etc). With record-triggered flows, you ...
Matthew Souther's user avatar
1 vote
0 answers
218 views

Filtered Knowledge Article Search in Einstein bot

I want to have a filtered search on the knowledge base using user's input in Einstein Bot. I understand there is an OOTB feature in Einstein bot to use Knowledge Object search wherein max of three ...
starhunter's user avatar
0 votes
1 answer
197 views

Flow action input doesn't recognize apex defined type

I've 2 flow actions Create Folder and Get Resource Property. Create Folder returns an apex defined type Resource. Get Resource Property expects a parameter of type Resource, however when I pass the ...
vishesh's user avatar
  • 803
-1 votes
2 answers
530 views

I want to pass collection variable to apex class

I want to pass the collection variable from flow to Apex which generates the PDF so, in collection variable, there are multiple records ,that I want to show in visual force page @InvocableMethod()...
TEJ's user avatar
  • 1
0 votes
1 answer
165 views

Apex class called from a flow wont give me the option to pass a collection of records

I have a flow setup to pass in a collection of opportunities to process and send back a collection of opportunities. In the flow I have queried the opps, assigned them to a record collection variable ...
Greg Watkins's user avatar
0 votes
1 answer
57 views

Write an invocable apex class to remove characters from a string

Fairly new to Apex so please bear with. I am trying to write a simple Apex Class that makes use of the replaceAll function to remove unnecessary characters from a string. I've got as far as the ...
Matt Stone's user avatar
0 votes
2 answers
466 views

Territory Assignments on Account page in Lightning mode

Currently in my org having Territory rules as follows, "Account: Account OwnerEQUALS User1" then Account will assign with "Abc" territory. When we change the Account Owner in ...
Vinay's user avatar
  • 7
0 votes
0 answers
75 views

Dynamic output type from Invocable method

Is there a way for an Invocable method to return different output types based on inputs. For example, it could be List<String>, List<Boolean>, List<CustomClass> or List<List<...
vishesh's user avatar
  • 803
0 votes
1 answer
109 views

Record Trigger Flow Running Apex Job - Avoid Flex Queue Limit

We are using a managed package, Geopointe, to define regions and Assign Leads based on Assignment Plans. The Business is insisting that "warm" Leads (based on the Lead Source) be assigned ...
Jeff Callahan's user avatar
0 votes
1 answer
365 views

Help bulkify salesforce invocable method (called from flow)

I have a very basic invocable action that is used by a flow to return the useraccess record if the user has edit rights (if not, the return would be a null list - barring sysadmin users of course). I ...
Ben's user avatar
  • 3
0 votes
0 answers
50 views

Storing state in invocableApex class - Flow Action

I have a record-triggered flow on the Accounts object. This flow invokes an Apex Action method called sayHello, which takes the name of a public group as its argument: public class MyClass { @...
user135792's user avatar
0 votes
0 answers
120 views

Update Invocable Class to Batchable class in apex

I have a class that using invocable method, there is process builder in object LossDeal_Management__c that if it fits on criteria will call apex class and set the parameters on it. In invocable class, ...
Mustika Farma's user avatar
1 vote
1 answer
530 views

Use Invocable Apex Class with LWC

I have an Invocable Apex Method which I am using in a Flow and I want to call from my LWC. I have created a separate AuraEnabled Method to call the Invocable method. public with sharing class ...
Jeff Callahan's user avatar
0 votes
1 answer
199 views

Cannot get to the individual fields on an Apex defined collection variable inside of a flow

Continuig from the issue I posted just a few hours ago - Returning a list of lists to the flow returns error saying list out of bounds Here is my Apex action with the Invocable Method- public with ...
sumchans's user avatar
  • 633
1 vote
1 answer
306 views

Returning a list of lists to the flow returns error saying list out of bounds

I am returning a list of lists from Apex Invocable Method like below Here is my Apex defined class which I am using it later to create an Apex defined object inside of the flow. This class is in its ...
sumchans's user avatar
  • 633
0 votes
1 answer
276 views

How to parse list of custom Apex types returned from InvocableMethod in Flow

Given the following class with an @InvocableMethod: public class InvocableFileCountAction { public class FileCount { @InvocableVariable public Id recordId; @...
Thomas Taylor's user avatar
0 votes
0 answers
81 views

How to test @Invocable SendEmail method

I have a flow that calls an invocable method that sends emails. My class : public class SendVerificationEmailAction { @InvocableMethod(label='Send Verification Email' category='Email' description='...
Hajar BL's user avatar
-2 votes
1 answer
164 views

I have a simple class that grabs the last two digits of the current year. I need to make this class Invocable, how do I do this?

I need to just make this class an Invocable method so that I can grab the last two digits of the year from this class and add it to a text field on another object using a flow. This is the code from ...
Zzz's user avatar
  • 13
2 votes
1 answer
415 views

What's the best practice when creating multiple @InvocableMethods that can be used in a flow?

I would like to know if there are any best practices when building multiple @InvocableMethods for a Salesforce flow. As of now, Salesforce limits only 1 @InvocableMethod per apex class. Only one ...
apz's user avatar
  • 335
0 votes
1 answer
96 views

How to bulkify invocable method that receives a list of leads

@InvocableMethod(label='lead Round Robin' description='Round robin lead assignment' category='Lead') public static void AssignLeads(List<ID> ids) { Lead l = [Select Id, ...
Trace's user avatar
  • 87
1 vote
1 answer
72 views

Help with basic Apex

Hello trying to branch out of my basic Admin duties to learn a bit more on Apex. I am looking to create an Invocable Apex class that updates a User based on a list of Users being passed to it from a ...
Cory Iler's user avatar
0 votes
1 answer
399 views

Permission issues with apex classes

We have few apex classes which has @InvocableMethod and are used inside screen flows on production. These apex classes is not given access in profile/permission set. We have custom profile 'Platform ...
Jason Rickert's user avatar
1 vote
0 answers
186 views

How do we know in apex whether the context is executed from Flow asynchronous

I have a scenario where I'm inserting a record in future, and there is a flow automation on that object. The flow has an async path which is invoking an apex action. How do I know within that that ...
Manjunatha V P's user avatar
1 vote
2 answers
1k views

How can I find where an @InvocableMethod is used?

Given a class with an @InvocableMethod, how can I determine where the InvocableMethod is actually being used? Apex Classes don't have a "Where is this used?" button, only a "Show ...
Jason Clark's user avatar
  • 11.6k
0 votes
2 answers
74 views

Deduplicate list in Apex? (ApexAction for Flow)

I am competent with Salesforce but far less so with Apex! Due to flow limitations I am trying to do something with an Apex Action. I pass to the code below a TASKID. In turn this code finds other ...
Ben's user avatar
  • 3
0 votes
1 answer
382 views

Display List<String> from Apex class to Flow Screen Component [duplicate]

I have written a code which performs one particular automation. My objective is to display the output of type List string in the screen component of flow. When I try to create a new single record ...
sourav guha's user avatar
0 votes
1 answer
336 views

Error:Method does not exist or incorrect signature: void add(List<Contact>) from the type List<List<GetContact.methodOutputs>>

I am trying to pass a firstname and lastname to an invocable method and get a list back of contacts filterd on firstname and lastname but get the error before saving my class: Method does not exist ...
Thomas's user avatar
  • 2,294
1 vote
0 answers
112 views

Running User for Apex class invocable methods called from Process Builder

I am calling a invocable method from a Process builder, the running user is myself(System Admin), however the invocable method is running under "Automated Process" user? Is this the expected ...
sunil gupta's user avatar
3 votes
1 answer
117 views

Invocable Apex IconName Static Resource with full background

So I've finally had some success getting a custom static resource icon to display on my apex-action component in my flow, but I can't seem to figure out how to make the background color 100% without ...
Xtremefaith's user avatar
  • 4,490
0 votes
1 answer
215 views

I want fetch records on flow by invocable apex method

i have to fetch records by apex because in get records components its hitting the limit i want account records where parentID is null and website contains 'webdom' ,webdom its a formula varible which ...
user123713's user avatar
2 votes
0 answers
84 views

Is there any way to translate @InvocableMethod label and description

My company is providing a managed package that needs to be translated to many languages. We managed to customise most labels using a CustomLabel metadata file. This is working fine for both lightning ...
Guishu's user avatar
  • 21
-1 votes
1 answer
167 views

Add List of Inserted Id's to generic sObject List

I need to replicate the standard "Create Records" Flow Element in an Invocable Apex Class so that I can include some additional code before and after the insert. I am using generic sObject ...
Jeff Callahan's user avatar
0 votes
1 answer
525 views

How do I write a test class for invocable variable

I have an invocable method with variables. I am stuck how to set these in unittest. public class getBWS { @InvocableMethod(label='Status' description='') public static List<FlowOutputs&...
FenTro's user avatar
  • 29
0 votes
1 answer
1k views

Passing an variable from flow to @InvocableMethod

I am super close to getting this process to work, however, I am a little unclear as to how to deal with the @invocableVariable portion of the process. And just to preface... I am NOT a coder, like at ...
Kris Ryan's user avatar
1 vote
1 answer
181 views

Apex Class: Bulk Clone Records and Increment Field

I am working on an Invocable Apex Class to Clone Records based on a selected Objects. The base code I got from here is working well. Now I am trying to add logic to increment a field after the record ...
Jeff Callahan's user avatar
1 vote
1 answer
106 views

List has no rows for assignment in visualforce controller

There is a weird behaviour when referencing a visualforce page. I have a screen flow and I'm testing an Apex Action using @InvocableMethod. My method receives a List of Ids, and I use those to get a ...
joacoiudica's user avatar

1
2 3 4 5 6