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.

28 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13
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
525 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
214 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
0answers
164 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
19 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
35 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
0answers
97 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
1answer
272 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 ...
1
vote
1answer
308 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 ...
1
vote
0answers
302 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 ...
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
328 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
199 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
33 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
179 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 @...
0
votes
1answer
65 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 ...
0
votes
0answers
122 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
41 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
0answers
16 views

For FSL : I'm Trying to create an invocable method that automatically populates the Service Territory of an account

I'm doing this by using an invocable method and a process builder. However, I have very little experience writing apex code I have been unable to successfully create one Apex class that actually does ...
0
votes
0answers
58 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
52 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
51 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
64 views

Process Builder invocable Apex action does not list “Reference” for list of objects, only “Field Reference”

I seem to be missing an option in my Apex action type called "Reference" which should refer to the list parameter in my invocable method. All I get is "Field Reference", which then expects me to ...
0
votes
0answers
76 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
49 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
139 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
189 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 ...