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
32 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
74 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
32 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
13 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
39 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
38 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
45 views

Invocable Method in PB not firing

I am trying to call this invocable method via PB when the Demand_Gen_Owner OR the AccountOwner is changed. It doesn't fire and I cannot determine why. global class UpdateContactsFromAccount { @...
1
vote
0answers
56 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
96 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 ...
0
votes
1answer
42 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
1answer
124 views

APEX Class Clean Up: Round Robin Lead Distribution Model

The code below is responsible for assigning Leads utilizing Round Robin distribution. The process is defined as follows: Lead is created and meets predefined criteria within a automated process (...
1
vote
1answer
177 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
53 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
55 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: ...
2
votes
1answer
635 views

How to pass in a list of Strings to an Apex Action in new Flow Builder?

I have a simple screen flow, which takes in a case Cancel Reason, and if that reason is Other, will get allow a user to specify the other reason via text entry. We have an Apex server method called ...
0
votes
1answer
42 views

Global invocablemethod for Professional edition org

Professional edition can have up to 5 process builders, but their immediate action doesn't contain "Apex". If we install a managed package which has a global invocable method, will the Apex appear as ...
1
vote
1answer
252 views

System.QueryException unexpected token

Trying to return all fields in object System.QueryException: unexpected token: '(' when I run the Invocable class at the parents = assignment public with sharing class AuditReportBulkifyClass { ...
0
votes
2answers
193 views

How to Redirect to /secur/logout.jsp from @Invocable method

I have a requirement where I want to logout of salesforce when certain statement inside an @invocable method is executed. For this purpose, I am trying to use PageReference to redirect to "/secur/...
3
votes
1answer
174 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
vote
0answers
203 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
95 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
48 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
95 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
133 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
51 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
337 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'...
1
vote
0answers
246 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
254 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
46 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) { ...
1
vote
1answer
570 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
85 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 ...
3
votes
1answer
557 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 ...
4
votes
1answer
384 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
907 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
76 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
158 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
120 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
110 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
312 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
512 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 ...
2
votes
1answer
746 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
681 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
114 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
922 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
634 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, ...
1
vote
1answer
192 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
345 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
49 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
339 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:...