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
2
votes
1answer
780 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
128 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
1k 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
700 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
218 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
402 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
58 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
421 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
34 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
32 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
168 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
330 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
1k 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 ...
3
votes
1answer
469 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
544 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
2k 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
1k 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
215 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
488 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
713 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
281 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
2answers
1k 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 ...
1
vote
3answers
3k 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 = ...
3
votes
1answer
606 views

Issue with Invocable Method to Call Queueable

Ok, I'm officially confused. I've written some code to attempt to populate a Campaign lookup field on Opportunity based on some logic. The basic flow is Process Builder (so the client can ...
1
vote
1answer
248 views

Deployment of Invocable Apex class with Process Builder

I have Apex class that gets called from Process Builder to update a record. I have 89% code coverage but when I try to deploy its complaining it doesnt have enough code coverage as its failing at the ...
1
vote
1answer
381 views

Send email apexclass triggered by procesbuilder

Im very new to apex but I have managed to write a class that is been called by a button on the lead object to send outbound emails with attachments which works. I want to get rid of the button and use ...
0
votes
1answer
466 views

Process Builder Bulk Scheduled Actions Not Working

I have a fairly simple Process Builder where, if leads meet certain conditions, we will re-run the assignment rules. This is done with a scheduled action 0 Hours After LastModifiedDate that calls an ...
1
vote
1answer
382 views

Trying to call class method from a Trigger

So my class has global class SendQueue{ @InvocableMethod public static void send(List<ListRequests> requests) {...} global class ListRequests{ @InvocableVariable(required=True) public Id ...
1
vote
1answer
544 views

Calling a Apex method within a trigger

In my Class I have this method global class Queue{ @InvocableMethod public static void send(List<ListRequests> requests){...} } In my trigger I initialize the class, call the ...
1
vote
1answer
1k views

Salesforce REST calls returning INVALID_SESSION_ID when we are in Lightning Mode

I don't know how to explain this, but its totally weird and strange, Please take some time to read it. Let's understand the flow here, Let's start with the flow first what we are actually doing there....
1
vote
1answer
188 views

Does an Invokable Apex method called from Process Builder expect a list of one object?

Consider this Apex method, is it correct? @InvocableMethod( public static void processLead(List<Lead> theLeadList) { System.assert(theLeadList.size() == 1); ... } Does Process builder ...
0
votes
1answer
4k views

How do I pass a case to an Apex class from process builder?

I understand from this article that it is possible, my question is what do I choose in the process builder in order to pass a case and not some case's parameter? I don't want to pass the casenumber or ...
1
vote
1answer
171 views

Working with Email Templates in Apex

I've been working with Process Builder and using Email Alerts to send email. There is a requirement to have the due date calculated as a certain number of Business Days in the future. I wrote an ...
0
votes
2answers
165 views

Invocable Apex in Managed Package Not Returning Values

We have an Apex class in our managed package declared as global but it doesn't seem to be returning anything to our Flow. Used the class prior to packaging it and it worked fine (then it was Public ...
1
vote
1answer
1k views

@InvocableMethod Test Class help

I have an @InvocableMethod class that I use with Process Builder, but I am totally stuck on writing a test class for it. I process evaluates a 'Noise' record, and passes the CaseId to the method and ...
1
vote
2answers
313 views

Invocable Method returning List of List - Attempt to Dereference a null object

I'm working with cloud flow designer and having some issues with the Apex class callout. I know I will need to return a List<List<CustomSobject>> from the invocable method in order to ...
0
votes
1answer
188 views

Does class that is being called from Process Builder also runs in system Mode? [duplicate]

I am having global class "with sharing" and invocable method in that, I am aware that Process Builder runs in system mode, however I am having confusion around the class which is getting called from ...
3
votes
1answer
436 views

Can flow commit changes prior to invoking a method?

I'm trying to get some advanced architecture setup for my company, but I'm running into an issue with my design; looking for help. I'm attempting to execute an API call from Flow, but I'm getting the ...
7
votes
0answers
446 views

InvocableMethod not appearing in Cloud Flow designer [duplicate]

I have written an @InvocableMethod, with an @IncovableVariable as such: public class SimpleAccountLookup { @InvocableMethod public static List<Account> getAccountId(List<...
0
votes
1answer
223 views

Process Builder only calling invocable methods for top 3 records when uploading via DataLoader.io

First time posting and I'm quite new to SF. I've ended up on this site a lot when Googling to help me with issues - so thanks! On my org, we're uploading some opportunities via DataLoader.io that ...
4
votes
1answer
356 views

Process builder not activating in production

I have a process that runs a checkbox loop: that is upon insert it turns off checkbox and then 1 day later it turns it back on so that the process can evaluate everyday. Most importantly, it triggers ...
0
votes
1answer
140 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 ...
3
votes
1answer
143 views

Can't see Invocable Variable within visual workflow

Part of a visual workflow I am creating invokes a method which should contain an invocable variable (newPattern) to parse info back. Unfortunately when I go into the flow to find the output it says "...
3
votes
3answers
812 views

Process Builder is not validating through change set

I have a process builder which perform apex invocable action. Its working fine in dev sandbox and this are the components I have built: 1. Process Builder 2. Apex Invocable class (...
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
2answers
175 views

Deleting a Pricebook Entry using Process Builder that invokes an Apex Class

apologies if i'm wording this incorrectly, i'm not a developer! I want to delete a pricebook entry if a checkbox is checked on the product object, I'm using process builder to determine the records ...
0
votes
1answer
82 views

How to pass List<SelectOption> in the invocablemethod [closed]

public static List<SelectOption> mimicUserProfile(List<List<Id>> IDs){ }
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 ...
4
votes
1answer
1k views

Help on Invokable Apex Test class and @Future callout Apex test Class

I am pretty new to Apex and trying to learn as much as possible. Any help would be really appreciated. I have two classes. Invokeable Apex Class: This class is just getting called by a Process (...
1
vote
1answer
649 views

Can we set Invocable Variables through a test class?

I want to write a test class to test an Invocable Method. Is it possible to do this without using the Process Builder to initialize my Invocable Variables? The code for the class I want to test is ...