Questions tagged [method]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-3
votes
1answer
19 views

Variable Global is not changed

Start static variable as true on first mute method to false I would like the second method to inherit the value of the first and not the global value calling the public method I want the boolean ...
1
vote
1answer
45 views

On click of button another method is called before the actual method is called [closed]

Im new to salesforce. I have just started with apex and Vf. I have built one vf where on page load it fetches account list and displays it in table. Before displaying it in table it calls another ...
0
votes
0answers
36 views

Error on a Future Method, But I Don't See How It's Being Called to Begin With

The only awareness I have of the error is from this email notification : Apex script unhandled exception by user/organization: 0051H000009g2Fv/00D1H000000NPnk Failed to invoke future method 'public ...
0
votes
1answer
24 views

Need to call different method from same class on Trigger context

I have written one class and inside that there is method which calling one small method ,what i need is to call inside method based on Insert and update If Operation is INSERT then call one method if ...
1
vote
1answer
65 views

[APEX]: Way to iterate over method parameters

I have a method that accepts 4 parameters. I want to do the same action for every parameter if it's not null. Is there a way to iterate over all parameters rather than building if blocks? So for ...
2
votes
1answer
1k views

Calling apex imperative method in lightning web component needs two click to show data

I have an apex method that has an attribute and calls a web service: @AuraEnabled() public static string getDetailEta(Integer idE) { system.debug('>> getDetailEta '+idE) ; ...
0
votes
1answer
31 views

Problem testing method returning List of custom objects

My company is using custom objects for Pricelist, Pricelist Items, and Products. I'm having this error trying to test my method to get a return of the Pricelist object as a List of Id. Line: 11, ...
0
votes
1answer
44 views

Access Object in Apex Class / Method after passing it from Controller

I (seemed to) have sucessfully passed an object from the client side helper controller into the apex method. However i am having trouble accessing using the dot notation i am used to in javascript and ...
0
votes
3answers
31 views

Data is not displaying on VF page but coming in Debug logs

Starting date of current week is not displaying on VF page (blank data), but coming in debug logs. Controller Code: public with sharing class Dummy { public date weekStart {get;set;} public void ...
2
votes
1answer
214 views

Is there any way to make an Apex method parameter lazy?

Let's say I want to call a method like: doSomething(a.b.c.d.e.f()); I know that this might be an expensive operation and a, a.b, a.b.c, a.b.c.d, and a.b.c.d.e might all be null, however I would ...
0
votes
2answers
48 views

Removing record reference in class

Expansion to original question: Error: Future method cannot be called Need to remove record variable from reference. Can someone help me and explain the process? Error: Error: Compile Error: ...
0
votes
0answers
87 views

Run Queueable as sequence

Good day Everyone, I have a trigger that will call a Queueable. The process looks like this : Trigger : for(User userData : Trigger.new) { if(Limits.getLimitQueueableJobs() - Limits.getQueueableJobs(...
0
votes
1answer
106 views

Difference between lock row and Record Currently Unavailable

Good day everyone, Last time,I encounter this error saying : UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record. I try to search a possible fix and I found that adding 'For ...
1
vote
1answer
61 views

Is it possible to call a future static callout method from a scheduler

I have a static callout which i want to schedule every 5 minutes. How would i approach this I have tried the following but the the incorrect signature error: Callout public class or_service { @...
0
votes
1answer
30 views

How to pass two same lookup records to one set <Address__c> parameter

i have two classes. in the first class account object having two lookup fields like "ship from" and "ship to". but these lookup object is one that is Address__c object. these lookup fields have ...
0
votes
2answers
33 views

Code Coverage low even though I'm calling the method

I am coding an Apex Test Class for an Apex Class. I am have trouble understanding why some lines of code are being covered while others are not. I also don't understand why the if statement in my ...
0
votes
1answer
30 views

Does an Apex Class run linearly (procedurally?)?

I am used to writing a run method in Java which specifies where the code runs. Outside of this nothing runs unless called. In apex there I don't see a run method. I'm guessing it starts at the top ...
0
votes
2answers
267 views

Update Parent when all children have the same field

How can I update the parent when all child records have the same value in a field? Ex. I have five child records under a parent record. The five child records have a field called Status, if ALL of ...
0
votes
1answer
55 views

Need help writing a test class for a refresh action on a VF page

I have created a VF Page Report for showing data based off of 2 dates. The VF Page works great but I am unable to get the code coverage I need to deploy. Right now all but lines 17-18 and 24-34 are ...
1
vote
1answer
48 views

How Exactly Do the Class and Trigger Connect in this Design Pattern?

Early on as an Apex developer, I adopted the following one-trigger-per-object design pattern: Class public with sharing class caseTriggerHandler { public static boolean firstRun = true; ...
1
vote
1answer
58 views

Apex class getSimpleName() equivalent

I would like to get Apex class name without namespace prefix. I wonder if exists any equivalent method like known in Java getSimpleName() ? Existing method getName() returns apex class name with ...
0
votes
1answer
23 views

Webservice overloading workaround

according to the documentation we can't overload a webservice method. If I need a dynamic option but can only call one method what would be the best way to get this to work?
3
votes
1answer
1k views

How to Pass Arguments and a Callback Using Aura Method

I can pass arguments or I can pass a callback to my aura method but the syntax for passing both an argument and a callback at the same time eludes me. I would like to pass the ultimateParentID var ...
0
votes
1answer
651 views

Pass value from one method to another

How do I pass a value from one method to another. I am using a public list with a {get; set;} but this seems not to be working. What I want to achieve is to loop trough the insert from the first ...
2
votes
1answer
441 views

Multiple Methods on Trigger

Is it good practice to allow a trigger to run multiple methods at once? For instance, if I had two methods I wanted run before insert, could I do the following? if(trigger.isbefore){ object....
-4
votes
1answer
1k views

Method does not exist or incorrect signature: void isEmpty()

I Get te following error on my testclass: Method does not exist or incorrect signature: void isEmpty(). There are several answers to this but I still dont understand what is wrong with my testclass. ...
0
votes
1answer
688 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 ...
0
votes
1answer
41 views

Method does not exist even method is static

Simple Code I am putting, Complex one working :( public class Kat { public String name; public Integer age; public static void accentureDetail() { System.debug('Anything to fix bug'); } ...
4
votes
2answers
380 views

Winter 18 is “breaking” my aura:method call

With Summer '17 I was able to dynamically set an onclick event that would fire an aura:method and everything worked just fine. This is the code declared in my controller and loaded during the ...
1
vote
1answer
1k views

Apex method to retrieve the download link for a standard Attachment

I stumbled across an Apex method in the documentation recently that would generate a URL for the download link for a standard Attachment, with a name something like getDownloadLink(). I don't ...
1
vote
2answers
487 views

Method does not exist or incorrect signature: void currentPages() from the type ApexPages"

I'd be glad if someone could help. I'm trying to retrieve Book object records from a Booking request object page via an availability link on the Booking request VF page where Book and Booking request ...
0
votes
1answer
82 views

How to refactor Synchronous code with future method

I have a future method that is called in trigger to create some records, and after that i use the records created in the future method to associate them with other entity. Since future methods are ...
1
vote
1answer
269 views

method does not exist or incorrect signature list

public class ListEx { public static void mymethod() { list<integer> myList= new List<integer>(); myList.add(10); myList.add(30); myList.add(40); ...
0
votes
0answers
89 views

What is retString()?

I am reviewing some old code and came accross this line: List<String> segments = seg.retString(); seg has a value that's over 255 characters. When I run this method my output is empty ...
1
vote
3answers
438 views

When is set and get method called in apex class and whats the issue when we don't use it?

public class opportunityextension2{ public List<opportunity> opplist{get; set;} public opportunityextension2(ApexPages.StandardSetController controller) { } public ...
0
votes
1answer
47 views

void loop runs no effect

I am attempting to write a simple test for a for loop that cleans the websites fields of unwanted elements such as 'http', 'www' etc. The script works for me but the test class that I wrote gets me 0% ...
0
votes
1answer
342 views

Can't call the method and display it an apex repeat [duplicate]

Hi I have the following problem. I wrote a class that would display events on a visual force page but it doesn't seem to be working as it should. The query is now fixed and it is allowed to be passed ...
0
votes
1answer
45 views

Utility method checking if input is numeric - implementation advice

How can I create an apex method inside a utility class that checks if field's value is numeric? public class ErrorHandler{ public static boolean IsValueNumeric(object tv) { boolean ...
1
vote
2answers
803 views

Access one methods input parameters in another method of same class

In my web service method i am passing few string parameters. I want to use these parameters in error message body. I simply can't put these strings as it will give error : Variable does not exist @...
2
votes
1answer
2k views

Overloading method return type in Apex

Does Apex support method return type overloading ? I mean can I have a method in a class that return different type depending on it's Inputs ?
1
vote
1answer
615 views

How to pass parameters in Apex to visualforce page so that they are not visible in the URL address? [duplicate]

I have an apex method with return type PageReference. When the method returns value a custom visualforce page is loaded. I want to pass few parameters from the method to the visualforce page. At the ...
3
votes
1answer
590 views

Instance method clashes with static method

I am working with Apex inner classes and I got the limitation described below I can't name a method in my inner class with the same name I used in a static method in the containing class When I do ...
0
votes
1answer
37 views

Method does not exist - {List}.get(Decimal)

I get errors for the last line. Method does not exist - {List}.get(Decimal) opp.Most_Expensive_Competitor_Price__c = oppCompetitorPrices.get(highestPrice); I am trying to populate the ...
0
votes
2answers
43 views

line 20:29 no viable alternative at character ' '

Hi Salesforce stack exchange. I am a newbie when it comes to apex, and struggling with a particular issues. I'm having created a simple test Utility Class (using examples online). The utility class ...
0
votes
1answer
67 views

Test class unable to find “Method or incorrect signature”

I'm having created a pretty simple test Utility Class. the utility class should create two records: an account and a related child (Legal entity). Legal entity is a master detail relationship to the ...
2
votes
1answer
259 views

Can we straightly send to printer from VisualForce? [closed]

Do we have a native way to print from visualforce itself? I know there is Javascript print method Browser.Print() . But our requirement is to directly send to printer, I'm not sure if we can access ...
0
votes
1answer
27 views

System.NullPointerException: Attempt to de-reference a null object Class.Class2.method1

I have an apex class Class1 that searches for a specific account. On search, some account details with its related contacts will be displayed, as well as empty fields to create new opportunity for ...
0
votes
1answer
51 views

Update a single quoteLineItem based on the below condition

I need to update a single quoteLineItem, whenever a custom checkbox "PROMO" is checked, a custom field "Discount %" has to be filled in with "20" in the same quote line item. There can be several ...
0
votes
2answers
5k views

How to Call Method in Another Method Within One Class?

I have three custom objects named Parent__c, Child__c, and A__c. I've used A__c as the standardcontroller. It serves as the search page for Parent__c record, wherein on click of a lookup field, all ...
2
votes
1answer
277 views

Getting error “Method does not exist or incorrect signature: approveRecord(Patient_Package__c)”

Below are my two methods. I am getting error at "approveRecord(ppcklist[index]);" saying Method does not exist or incorrect signature: approveRecord(Patient_Package__c) public static void ...