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.

35 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14
votes
1answer
2k views

Bad rightOperand type: got SObjectScriptRow

I just want to know what is SObjectScriptRow! All I can find about it is this question. I'm building an invocable method to be used from a process, where I have one input parameter: a list of an ...
6
votes
1answer
587 views

@InvocableVariable of List datatype

I'm building an Apex action for Process Builder and would ideally like to pass in a list of strings as an @InvocableVariable. Per the SFDC documentation, "The data type of the invocable variable must ...
5
votes
0answers
247 views

Possible to create a generic “invocable class” per object?

My organization is starting to feel some pain around using Process Builder + Flow (error handling mostly, but also inherent Flow inefficiencies and the inability to run Flow in system context). Thus, ...
2
votes
1answer
642 views

Using Invocable Apex in Flow Builder, can't save result?

I have a flow that will be used to convert a list view of selected records of unknown type to custom object records. When the flow launches from a list view page, there will be a screen element where ...
2
votes
1answer
1k views

Flow Error - The number of results does not match the number of interviews that were executed

Calling Flow from Process Builder and getting error. The Flow has Invocable Apex solely to collect the "bulkified" records that Salesforce gathers, it was my understanding this is how we gathered them ...
2
votes
0answers
188 views

Post callout behavior assertions for unit test with static resource callout mock fail

I have a working queueable callout, and working tests using static resource callout mock I can successfuly run basic assertions on the mock response body and status. However, the callout method in ...
2
votes
0answers
4k views

How to call an apex class from process builder

I would like to update a specific set of fields based on owners on opportunities. We wrote an apex trigger and some other classes. Everything is working fine. But when a user changes an account owner ...
1
vote
0answers
28 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' ...
1
vote
0answers
104 views

Apex Action not showing in Process Builder but does show up in Flow Builder

I have an Apex class containing an Invocable Method and no Invocable Variables that does not show up in Process Builder but does show up as an Action in Flow Builder. Normally this wouldn't be a ...
1
vote
0answers
39 views

How can I make parent class variables Invocable in flow and process builder?

I have a scenario where I have an InvocableMethod which takes a custom Class with properties which are made available with the @InvocableVariable annotation, but I want this class to extend a parent ...
1
vote
1answer
52 views

Can't Return values in Apex from Flow Winter 19

I'm trying to refactor a flow I built in Spring 20, back to Winter 19. In Spring 20, I can just create a resource for my Apex Output. I've called this variable {!apexReturnedObj} I'm trying do some ...
1
vote
1answer
327 views

How to avoid Apex CPU time limit exceeded error with Process Builder?

We have multiple rules setup for Case using process builder but one of the rule seems to be failing throwing CPU Time Limit Exceeded error. The process is failing at this step where i am updating ...
1
vote
0answers
147 views

Invocable method giving error in FSL flow mobile

I created a flow using Flow designer and it is a FSL mobile flow. Here I basically uploading a file and then using the same for Einstein Prediction and here is how I'm doing. Upload file using ...
1
vote
0answers
17 views

How to properly report an error from InvokableAction

I'm creating an InvokableAction that should be ran as a part of the flow. This action has two string inputs, but one of them must accept only one of the three specific values. As far as I know, I can'...
1
vote
0answers
504 views

How to pass multiple param in invocable method

from visual flow i am calling apex class, while calling I need to pass 5 param(3 List, 2 String).but it is not accepting more than 1 param @Invocalble method how to solve this public class SendMail { ...
1
vote
1answer
346 views

How to write an invocable class error method

Suppose you have an invocable method. How do you write an error message?. public class AccountQueryAction { @InvocableMethod(label='Get Account Names' description='Returns the list of account ...
1
vote
0answers
40 views

update record based on mutiple queries to related (sort of) objects

My objective: Once an Opportunity is Closed/Won and the quote is the primary, look up the product2 related to the quote line(custom) and find the related subscription plan(custom) and pricebook(...
1
vote
0answers
200 views

Test Class with @invocableMethod

I wrote an Apex Class (with the help of some code I found on the internet, because i'm not a developer) to help automatically post some content to chatter with @mention. This Class had a @...
1
vote
1answer
785 views

Invocable Methods: How to return a collection of records to flow

This is my first time posting in StackExchange, and my first real attempt to put together some code. I am attempting to query CampaignMembers from the data base after passing a CampaignID to the ...
0
votes
0answers
12 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
0answers
37 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 ...
0
votes
0answers
29 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
30 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
20 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
0answers
25 views

Deep Linking From Salesforce 1 App

I am using the Salesforce 1 iOS app and I want to embed a deep link in a custom button. This link must work offline (we utilize the SF1 Offline Caching capability) so I need to utilize the myapp:// ...
0
votes
1answer
47 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 ...
0
votes
0answers
214 views

How do I populate Salesforce records using REST API to collect data for updating

I'm new to working with API's and code in general, I have been challenged to create an invocable Apex class that calls a rest API to collect data to input into the Salesforce record that invoked the ...
0
votes
1answer
214 views

Visual Flow and Callout

I have a small problem with visual flow. I try to execute callout in flow through @InvocableMethod but before this callout, I do update a record(standard update action in Visual flow not in apex code(...
0
votes
1answer
136 views

Einstein Bot apex causes 'close chat' message intermittently

I wrote a simple InvocableMethod to increment the amount of times an Einstein chatbot answers a users message. This works sometimes, very inconsistently. Sometimes it fails right away when I call a ...
0
votes
0answers
125 views

Flow screen component “Phone” field can not be assign to invocable variable

I have created flow and in this flow screen I have phone field. however, I cannot assign the value from this field to invocable variable. I do not see "Phone" in the dropdown list in invoacble ...
0
votes
1answer
104 views

Process Builder activation error

I have a process builder that invokes a method from a class where it passes one of the three parameters. In the class the InvocableVariable is a List of Custom object Call__c but from process builder ...
0
votes
0answers
138 views

Invocable Apex working when called from Process Builder but not Flow - what's wrong?

I have an invocable method that works just fine when I pass a Contact record Id to it via Process Builder. I'd like to use Flow to do this rather than PB, but get this error message: Error Occurred: ...
0
votes
1answer
58 views

Invocable class does not appear in drop-down

I created a very simple class with an invocable method: public class CKZUpdateAccountCreditLimit { @InvocableMethod public static void updateAccountCreditLimit(List<Id> invoiceIds) { ...
0
votes
1answer
213 views

New Opportunity Owner is not receiving Email Notification in proper sequence and receive more than 1 email for different opportunities in apex

I have a requirement in which when I deactivate a user, a deactivation email should be sent and all of the user's opportunities get reassigned to their manager. When the Opportunities are assigned ...
0
votes
0answers
190 views

How to make REST Callouts from Visual Workflow?

We have a requirement where we need to accept some inputs (couple of text inputs) from user and pass this input to a REST Service which will return search results(List of a custom class) based on the ...