Skip to main content

Questions tagged [static]

3 votes
1 answer
96 views

I'm wondering if there is a way to get multiple transactions (with different contexts as far as static variables are concerned) within one test. I have a Trigger handler class where there is some ...
Jazzer's user avatar
  • 228
0 votes
0 answers
136 views

What are the options to display static content (html) on Experience cloud site as a reusable asset between pages/portals? I understand that there are options like following: Use external system like ...
Patlatus's user avatar
  • 18.8k
0 votes
1 answer
515 views

I have a batch class and some static variables which I am initializing in the constructor. Getting the error: Static field cannot be referenced from a non static context. This error is shown from ...
coder123's user avatar
  • 155
0 votes
1 answer
77 views

I am trying to run a dynamic query, using Database.query(), which includes a static variable from another class. This works correctly: static Id x = LocalUserInfo.currUserId; system.debug (x); User u =...
hamayoun's user avatar
  • 2,809
1 vote
1 answer
190 views

In order to cover a specific requirement, I need to determine that the DML action of inserting the records of an sObject has been triggered through a batch. The System class provides the isBatch() ...
Tzinm's user avatar
  • 126
0 votes
1 answer
172 views

I do not understand why I get an error in the line isExecuting = false (Variable is not visible) But if I comment out that line the error disappears. Thus, from the same getter, the line if ( ...
SFDC Dev 27's user avatar
0 votes
1 answer
66 views

I tried to write my code like this: public static string getPicklistValues(String fieldApi) { List<String> picklistValue = new List<String>(); Schema.DescribeFieldResult picklist = ...
Tuấn Trần quốc's user avatar
1 vote
1 answer
124 views

Definining 2 class variables with same name does not always fire Duplicate field compilation error when deploying apex class to the org. Code sample : public with sharing class MyClass { Boolean ...
Shamina's user avatar
  • 5,212
3 votes
1 answer
138 views

As of Spring 23, several tests where we publish platform events started failing. We use a static flag as a condition to execute a code block and looks like now the line where the flag is being set is ...
user127426's user avatar
0 votes
1 answer
332 views

I need to make a callout to retrieve some data, then have that accessible from static apex methods. The easy option is to perform the callout from within the static method but that would be ...
ministe's user avatar
  • 344
1 vote
1 answer
5k views

I have an Apex class OpportunityUpserter with a static method, where the static method makes a call to another static method in a class called IntegrationUtilities, as shown below. This gives me a ...
yvoloshin's user avatar
  • 113
0 votes
0 answers
115 views

I understand questions like this have been asked in the past, mostly relating to test classes from what I've seen. I've spent hours trying to find a legitimately applicable question/answer to the ...
jdrussett's user avatar
1 vote
1 answer
2k views

I have a global class with a static method which makes post callout and I want to use Stub API, but I don't get how to do it when a method is static. I understand what to do inside mock classes, but I ...
lemleborze's user avatar
0 votes
1 answer
58 views

In one method I set the value of a static variable, in the other I want to get it, but I get null: public class CurrencyExchangeController { public static String requestDate; @future(...
unique user's user avatar
17 votes
1 answer
2k views

Assume we have some simple interface: public interface IExecutable { void execute(); } and some class that implements the interface: public class Executor implements IExecutable { public ...
Oleh Berehovskyi's user avatar

15 30 50 per page
1
2 3 4 5