Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
1answer
46 views

InvocableMethod Through anonymous APEX

I have an invocablemethod that runs from a process builder that got broken for a few months I had a mapping issue and some fields didn't populate or create for various reasons. In the process builder ...
-1
votes
0answers
23 views

Invocable Class To Return Multiple Objects Illegal Assignment Error

Missing the correct concept here and struggled too long. I am trying to optionally gather multiple multiselect inputs in a Flow, split them in Apex, and return multiple Sobject Collections. I ...
0
votes
0answers
29 views

Slack integration w/ Salesforce - @mention user? [on hold]

I created a webhook that I am making a callout to and the message is getting through to slack but I am wondering if there is a way to '@mention' a specify user in slack based off the owner of a ...
0
votes
0answers
62 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 ...
0
votes
2answers
26 views

Method does not exist or incorrect signature invocable

Asked and answered here many times but I'm not finding this scenario. Getting method does not exist error when trying to invoke this Apex Class in my test. global with sharing class ...
0
votes
0answers
23 views

Flow Apex Element Error - System.UnexpectedException: INVALID_SESSION_ID

Created a visual flow for user administration. When a user creates a new user the email notification with link is not sent to the user. This solution works: How to send welcome email via API? Using ...
4
votes
2answers
77 views

Standard invocable actions API: How to detect whether an input expects an array?

I'm working on some functionality that calls some standard invocable actions via Salesforce's REST API (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/...
3
votes
1answer
44 views

Supply sObject record to process builder flow via REST API

I'm trying to invoke a custom flow (built via process builder) via REST API. The process begins with a contact record, This process starts when another process invokes it. Select an object ...
1
vote
1answer
20 views

Resuming Flow after Invocable Future Method

Is there a way to resume a Flow after an @Future Apex method is completed? Right now I have an arbitrary Wait element but that's a hack workaround and not reliable of course. Cross posted in ...
2
votes
1answer
89 views

Platform Events + Process Builder + Apex with @future method

I'm running into an issue with too many future calls when handling Platform Events with a Process Builder that uses an invocable Apex class. Basic setup is 2 processes: The first publishes an event ...
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'...
0
votes
0answers
22 views

How do I use Process Builder to populate a text area from a list?

I have a custom object in which I'd like to build a text area with concatenated values from a list of products, without using an Apex trigger (if possible). My custom Object, CourierBooking__c, ...
1
vote
0answers
64 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
61 views

How to set the variables of invocable method in unit test

I have an invocable method with varables. I am stuck how to set these in unittest Class public class or_service { public class invoceVars{ @InvocableVariable public id ...
0
votes
1answer
23 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
70 views

How to use @invocableVariable in Callout

I want to use the processbuilder to do a callout. In this callout I want to add some variables from the current record but get variable does not exist see below: global class or_service { @...
0
votes
1answer
41 views

Calling Flow From Detail Page Button

I have (hopefully) a simple problem. I am calling a flow from a Detail Page Button: /flow/Send_Message?objectId={!Account.Id} Send_Message flow starts on a Screen block. The Screen has two String ...
2
votes
1answer
160 views

Getting System.FinalException: Record is read-only when PB calls an apex class

I am getting this error whenever my Process builder calls an Apex Class. I'm not sure if this is allowed so I'd like to ask for your input. So basically, my Process Builder is in the Case object and ...
2
votes
1answer
104 views

How to display error message to User when InvocableMethod throws an exception

Background I am using Process Builder to run an Apex InvocableMethod which sends some data to a 3rd party REST API. Sometimes the 3rd party REST API returns a validation error. Question How can ...
1
vote
2answers
282 views

Setting Invocable Variables in Test Class

I'm having difficulty finding the syntax to set my invocable variables in a test class related to the below code. I just put the relevant top part of the code in there. How can I set the ids to my ...
0
votes
1answer
42 views

Email alert vs invocable apex

I'm trying to understand what are the benefits of using invocable actions called by Process Builder comparing to Process Builder + Flow. In what scenario invocable actions are preferable?
1
vote
1answer
38 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 ...
2
votes
1answer
68 views

DateTime Vs. Date Flow To ProcessPlugin

I find this to be odd, not sure if this is a known issue or if it is something I just have to convert but I have a flow that calls a apex process plugin class. The flow takes a variable of type Date ...
0
votes
1answer
87 views

Is this expected behavior on InvocableMethod ? (Trigger order of execution)

I am trying to explore order of execution more. Hence I tried following things. Create a number field say - TestNumber Wrote a trigger. In before context, updated it +1. Have a workflow which ...
0
votes
2answers
78 views

Automatically Publish a Draft Article

I am trying to publish an article from a flow. I have already created the article successfully(in the flow), but the item is created in "Draft" status. Once the article is created, I am capturing the ...
1
vote
2answers
198 views

How to have an InvocableVariable appear as Drop Down List in Process Builder

BACKGROUND I have a class with an InvocableMethod which takes a set of InvocableVariable's Such that I can call the Apex class from Process Builder. QUESTION I would like one of the fields to ...
1
vote
1answer
261 views

Use invocable variable of type List<String> in Process Builder

I have an invocable method: @InvocableMethod(Label = 'Submit Privacy Source') public static void action(ActionRequest[] requestActionInList) {...} ActionRequest is: public with sharing class ...
2
votes
1answer
248 views

Using return value in system.assertequals

I created an Invocable method for Process Builder and am building the test class. I am trying my hand at the system.assertequals statements but I can't figure out how to get the return value from the ...
0
votes
1answer
65 views

Test failure 7% for HTTP Call out [closed]

I am not sure why I am getting the two errors I labeled below during the http send in the first class or in the Mock Impl class when I assert the endpoint. public class ProcessHandlerShowAccounts { ...
0
votes
1answer
341 views

Variable does not exist in test class

ProcessHandlerShowAccounts class works, but I am trying to get my test class up to par to validate my data. I am getting a variable does not exist, not sure why Did I initiate the class wrong? Also ...
1
vote
1answer
438 views

You have uncommitted work pending. Please commit or rollback before Http Callout [duplicate]

I set up a Process Builder to activate when an Lead reaches a certain sales stage. Then the Process Builder will send two variables to an invocable method within my apex class. On the Lead object, ...
0
votes
1answer
89 views

InvocableMethod - One Input and one output

Can someone let me know if there is a better way of coding this? I want to pass one ID to the class from a Visual Flow, which is the ID of the current user, and then get back a count of the records ...
0
votes
1answer
167 views

Variable does not exist within invocable method

I am trying to access the variables sent from the Process Builder within the apex class. It says the variable accountParamter does not exist, which confused me because I declare it in the parameters ...
3
votes
2answers
33 views

Invalid loop variable error:Process builder to apex call

am calling an apex call from process builder.In process builder am sending an id of invention disclosure object and in the class am getting an error as: Error: Compile Error: Invalid loop variable ...
1
vote
1answer
175 views

Query Error with IN operator must be used with an iterable expression

I am trying to pass multiple variables from Process Builder to my Apex Class, and eventually manipulate those values to update fields in the Account object. The below code produces this error message:...
1
vote
0answers
28 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(...
0
votes
1answer
16 views

Implement a process builder which invoke apex on professional organization

How can I create a process builder which will invoke an apex method which is in a managed packaged from a Professional Edition Organization? When creating the Action, I can't find apex in the option ...
2
votes
0answers
73 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 ...
0
votes
1answer
138 views

(Flow + Invocable) System.UnexpectedException: Illegal arguments

I am getting a very strange exception when trying to invoke Apex from a Flow: Sandbox: Error Occurred During Flow "Account_Update_Lead_and_Contact_Fields": An Apex error occurred: System....
1
vote
1answer
388 views

Test class for invocable method [duplicate]

I have no idea how to write a test class for an invocable class that I am using to reject all the adjustment records whose status field is updated as Rejected using Process Builder. I have created ...
2
votes
1answer
184 views

Flow and InvocableMethod Simple Question

How would I create an array of the values from the flow and pass them into the APEX @InvocableMethod? My method is taking in a list of Strings: @InvocableMethod public static List<String> ...
2
votes
2answers
230 views

(Solved) Writing Apex Test for Twilio SMS and Twilio Call?

I have working Code the sends an SMS or Voice call via Apex and Twilio, Great stuff. The trouble I am having is writing the Tests (maybe because its Friday?) and I just need a little help. I don't do ...
0
votes
1answer
733 views

Future Method and Static Variables

I have a class that implements Process.Plugin. It calls the invoke method, which calls a future method, which calls a webservice. The returned value from the webservice should be the output parameters....
3
votes
1answer
384 views

@InvocableMethod/Process.PluginResult And @Future

Is it possible to set either the @InvocableMethod or Process.Plugin with a @future(callout=true)? My problem (bear with me): I have a trigger that calls a class the class creates an object and ...
5
votes
0answers
153 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, ...
-1
votes
2answers
324 views

Future method cannot be called from a future or batch method

I am calling an Apex Future method from Process builder. This is working fine when the Process Builder condition is "only when a record is created". But when I change the condition to "when a record ...
0
votes
1answer
617 views

Save Error in Test Class for @InvocableMethod: Static method cannot be referenced from a non static context

I'm trying to write a simple text class for another simple class that has an @InvocableMethod method, but receive the save error in the question's title. I can't figure out its cause or how to ...
1
vote
1answer
178 views

Using @InvocableMethod Apex Class how can I AutoConvertLead, but using Existing Contact ID from a custom field within same Lead record

Can anyone kindly help with amending the below code so that it can convert the Lead to an existing Contact (and contact's Account) by using the specified Existing Contact ID which would be stored on ...
0
votes
1answer
465 views

Passing a list of records to an invocable method

The documentation on invocableMethod clearly states that you can pass in a list of a sObject type. There can be at most one input parameter and its data type must be one of the following: A list ...
0
votes
1answer
1k views

Invocable method Apex class is not visible in Process builder

I am trying to use following apex class with invocable method but its not showing in process builder. global with sharing class SlackOpportunityPublisher { private static final String slackURL = ...