Stack Exchange Network

Stack Exchange network consists of 175 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 [apex-variable]

The tag has no usage guidance.

3
votes
1answer
29 views

What is the difference between a variable and an automatic read-write property?

Accordingly to the Apex Developer Guide, An Apex property is similar to a variable; however, you can do additional things in your code to a property value before it is accessed or returned. ...
0
votes
0answers
17 views

Maintain the State of a Controller when Opening a Shared Controller VF page as a Console Tab

I am trying to pass all of the values from an object from one Visualforce page to another. objX is queried for two fields id and fieldOne and stored in a list on the controller: listObjX The object ...
0
votes
2answers
44 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: ...
2
votes
2answers
640 views

What is this technique called?

public static List<Holiday> holidays { get { if(holidays == null) holidays=[Select h.StartTimeInMinutes, h.Name, h.ActivityDate From Holiday h]; ...
0
votes
1answer
33 views

How to pass query variable from soql into loop

I am trying to bulkify a callout where I want to pass the recordtype in my loop but I get: Error: Variable does not exist: RecordType If I try public RecordType personAccountRecordType I get ...
0
votes
1answer
24 views

Add a starting value to an Apex:Variable in a Apex:repeat Table

I have created a simple table of data in a VF page, which uses Apex:Repeat to list records. There is a column that contains a cumulative amount, by way of apex:variable. The cumulative amount works ...
0
votes
1answer
31 views

How to make variable show the count of records from a dynamic soql query [duplicate]

I have a custom controller with a variable 'count.' I want this to update on the page every time the account list updates. Right now it's static. It just displays the original number of records in the ...
0
votes
1answer
473 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 ...
0
votes
1answer
200 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 ...
10
votes
4answers
692 views

Is there any benefit, performance-wise, to declaring Apex variables as final?

In other languages (see, for instance, Swift), stating explicitly that a variable is final lets the compiler optimize the code accordingly. Is this the case with Apex?
1
vote
1answer
77 views

Dynamic Fields in for Loop

Is there a way to dynamically change the fields within a for loop? As an example, if I have for loop: for(Account a: myQueryResult){ if(a.parentId = fieldVariable){ Do something ...
0
votes
1answer
209 views

Issues updating a apex variable on visualforce page

I have an apex variable that is the summed value of record amounts in a pageBlockTable. The idea is when an amount value is changed, a javascript function is called to recalculate the amount for all ...
0
votes
3answers
47 views

Variable does not exist on trigger class

For the following class, I get the error 'variable does not exist: mq' on lines 25 - 27 Public with sharing class InspectionQuotasHandler{ public static void UpdateMonthlyQuotaOfInspection(List&...
2
votes
1answer
263 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> ...
0
votes
1answer
146 views

Variable does not exist in global method - batch class

I have tried to put together a batch class to update parent Account records with credit scores.. I need to make 2 list variables public so I am able to access them in the finish global batch method, ...
3
votes
1answer
70 views

VF Component modifying an apex:variable outside of its scope

I just stumbled upon a weird behavior of Visualforce Components (or apex:variables). Please see the code below and then the end result: VF Page <apex:page> <apex:variable var="foo" ...
0
votes
1answer
219 views

Escaping variables in Email templates

I am trying to build the body of an email by using the fields of a given custom object(SObject). On this given SObject I am including some variables. One of those variables is the title of the Contact....
1
vote
2answers
3k views

Round off an apex variable upto two decimal places

I have apex variable in my visualforce page, which is calculated as below - <apex:variable var="cntFinal" value="{!IF(cntVar1==0,0,(cntVar2+cntVar3)*100/cntVar1)}"/> Now, I want to set this ...
2
votes
3answers
262 views

Accessing passed variable from Visualforce page OR pass Controller.addFields in TEST

I want to pass the pricebook2id from an opportunity to my apex class and then use this when querying. I can get it using the Controller.addFields when declaring the controller like this: public ...
0
votes
1answer
177 views

Accessing the deserialised object from a different class

I am using the following class to deserialise a JSON object: //Method to deserialize the response body public static responseResource deserialize(httpResponse res){ return (...
1
vote
1answer
75 views

Compile Error on Map: Variable WhoId Doesn't Exist

Got the compile error for the snippet of code below. Says variable record.whoId (bolded) doesn't exist. Tried adding more brackets to the if statement, capitalizing WhoId and didn't work. Here's the ...
0
votes
2answers
727 views

Get value from custom setting

I have a batch process that I want to be able to dynamically tweak the batch size without changing the code in sandbox and then deploying each time. I figure I can use a custom setting as I have been ...
1
vote
0answers
176 views

SOAP Call w/o WSDL body too large error

I am working on integrating an asmx webservice into salesforce. I was unable to parse the WSDL into apex, so have to build the calls manually. The call I built works and is received when literal ...
0
votes
2answers
180 views

New Line in Apex Variable

I am trying the following code: <apex:variable var="variable1" value="{!CASE(object.field, "val1", "line1 line2", "val2", "...
1
vote
1answer
386 views

Variable does not exist: insert record

I'm trying to insert a new record into an object where I pull information from OpportunityLineItem, Product, Opportunity, and Account. I did a query and get the results I want. Then I go to create a ...
3
votes
1answer
282 views

Pass a variable from Javascript to Apex Controller

I'm trying to pass a variable from a javascript inside a VF page to a varibale in the Apex Controller. The VF page code is: <apex:page controller="uploadDataTosObject" apiVersion="36.0"> [...
0
votes
0answers
491 views

Stop increment of apex variable

In my VF page I have: <apex:pageblockTable value="{!interview.Skill_review__r}" var="skillreview"> <apex:column headerValue="Rating"> <apex:...
1
vote
2answers
672 views

Trouble passing variable from Apex to VF Page

I'm trying to pass a simple string to a vf page, but can't seem to. What am I doing wrong? APEX public class ControllerJSGeo{ public String pId; public String testString {get;set;} ...
1
vote
1answer
321 views

Define apex:variable in apex:inputText

I'm trying to pass parameters while using immediate=true. (actionRegion is not an option) Since this won't work: <apex:inputText value="{!searchValue}" /> <apex:commandButton value="...