Stack Exchange Network

Stack Exchange network consists of 174 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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [compile-error]

Compilation error refers to a state when a compiler fails to compile a piece of computer program source code, either due to errors in the code, or, more unusually, due to errors in the compiler itself. A compilation error message often helps programmers debugging the source code for possible errors.

0
votes
1answer
16 views

Variable does not exist: Quantity

Variable does not exist: Quantity Although it does exist as I added a value to it and it worked fine this is the code @isTest public class AssetTriggerTest2 { @isTest static void test(){ ...
0
votes
2answers
48 views

Getting an “Invalid Definition for Null” error when trying to associate controller with component

I'm creating a lightning component named "scroll" and a controller file associated with it. Here's the opening tag of .cmp file: <aura:component controller="scrollController" implements="force:...
3
votes
1answer
36 views

Not being able to access Flow variable in Apex class

I am trying to create a flow which creates an account record and then navigates to the newly created record detail page VF Code <apex:page Controller="AccFlowController" TabStyle="Account"> &...
0
votes
1answer
23 views

Batch Scheduler Error

I have Created a batch scheduler which need to run for Every 5 min. but i am getting this error. can any one please help me out. Error: Compile Error: Method does not exist or incorrect signature: ...
2
votes
1answer
62 views

SObject List syntax error

In Execute Anonymous, I'm trying to bulk-process a list of sObjects by passing a list to the DML operation with multiple fields. When I just define the 'Name', it works. When I add Field1 and Field2,...
0
votes
4answers
32 views

How to skip Required fields upon auto-creation of an object record?

I have this situation where I want to create a record on the ACCOUNT object and only when my custom field in ACCOUNT called 'Account status' is changed from 'new' to 'prospect', then it should auto-...
4
votes
1answer
131 views

Variable not visible

When I try to save the code (API version 43), I keep getting a compile error stating: Error: Compile Error: Variable is not visible: testClass.XYZ at line 5 Here is the class: global with sharing ...
2
votes
1answer
139 views

illegal assignment from object to id Error?

I have written following code to insert records on junction object. public static List<PDCN__c> addSelectedPDCNs(List<String> selectedRecords, String groupId) { system.debug('...
8
votes
0answers
68 views

@deprecated annotation issue in Managed Apex

We have 2 managed packages. Let's name those MPMAIN and MPCHILD. MPCHILD package is dependent on MPMAIN. In MPCHILD we have a class: @deprecated global class ChildClass extends MPMAIN.MainClass { ...
0
votes
1answer
60 views

Constructor not defined executeBatch trigger to pass ID to batch class

Ok...trying to write my first class and trigger and running into a wall that I can't seem to get over on my own. Use case: on a custom object called manufacturer__c, when a field goes to "in Process" ...
6
votes
1answer
261 views

Any way to qualify a custom class to distinguish it from a property?

This problem comes up when you try to remove clutter from names because Apex is case insensitive so xyz and Xyz are not distinguishable: public class Xyz { ... private static Xyz[] query(...) ...
2
votes
2answers
347 views

Does Enum support hyphens?

I am trying to create an enum datatype for relationships in my apex class. Below is the code I am using: public Enum Enum_RelationShipCode {Father, Mother, Brother, Sister, Uncle, Aunt, Brother-In-...
-3
votes
1answer
81 views

What's the solution on the errors in apex?

Missing return statement required return type: List Illegal assignment from System.PageReference to String Illegal conversion from String to List Variable does not exist: cCaseId ...
10
votes
2answers
760 views

What is the best way to cast/convert Map<String, SObject> to Map<Object, Object> and back again?

To reduce code duplication, at the risk of type safety, I have some method: public Map<Object, Object> doSomething(Map<Object, Object> inputMap) { Map<Object, Object> outputMap; ...
1
vote
1answer
98 views

Recompilation Issue When Pushing To Production

I have a class that I updated and am pushing to production. When I validate, I am getting this error for all 300 classes in production: line -1, column -1: Dependent class is invalid and needs ...
2
votes
1answer
22 views

Unexpected token error for apparent valid assignment?

What is wrong with this test class? I'm getting the error: Error: Compile Error: Unexpected token '='. at line 7 column 19 This is at "email.subject = ..." What is possibly wrong with this ...
0
votes
1answer
52 views

Variable does not exist when trying to access 1st element of list

Below i the code : Map<String,Object> poVals = (Map<String,Object>)JSON.deserializeUntyped(POResponse); system.debug('poVals' +poVals); lstPODetails = (List<object>...
-1
votes
3answers
44 views

how can i create an account on button and pass the id's account?

I'm very new to Salesforce Development and I am struggling to figure this out. So i want to create 2 VF pages and 2 controllers and I want to create new account and insert that account when I'm ...
0
votes
1answer
84 views

Variable does not exist: MasterRecordId

below is the code trigger efs_ProjectTrigger on Project__c (after delete) { Set<ID> ProjectIds = new Set<ID>(); for(Project__c Proj:trigger.old){ if(Proj.MasterRecordId!=null) ...
0
votes
1answer
245 views

Invalid loop variable type expected Id was GroupMember

I am trying to write a trigger that will share a record that is created on a custom object(Split__c) with all the groups the record creator is part of. The reason for this is to share the record ...
-3
votes
1answer
466 views

Non static method cannot be referenced from a static context

I am trying to save the below code and getting this compile error: Non static method cannot be referenced from a static context: String System.HttpResponse.getStatus() at line Specific error line: ...
1
vote
2answers
42 views

compiler Error : Invalid type: Cache.OrgPartition

I am trying to use Platform cache via Apex Code. 1. Created a new platform cache partition in my org - 10MB assigned to Org Cache. Then created a simple apex class via dev console to access the ...
1
vote
1answer
16 views

Test Class calling Rest Resource with List containing multiple variable types

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from ...
2
votes
1answer
62 views

Need help with apex trigger to update/delete attachment id on custom field

I am trying to create a trigger that will update or delete a specific field in salesforce Products object accordingly. If there is image in the attachment to add the id and delete the id if there is ...
0
votes
1answer
581 views

Compile Error: Class Batch_Class must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>) [duplicate]

global class Batch_Class implements Database.Batchable<sObject>{ public String Field; public String Query; public String Value; public Batch_Class (String f, String q, String v)...
0
votes
2answers
41 views

Error on TestClass using Custom Controller

Getting an Error: Constructor not defined: [MyController].(ApexPages.StandardController) No error when changed to : MyController controller = new MyController(); but getting error on test Class: ...
0
votes
1answer
508 views

Variable does not exist: Name?

Why am I getting this error? How can I fix it? Error: Compile Error: Variable does not exist: Name at line 8 column 87 Code: trigger DuplicatePrevention on Account (before insert) { List&...
2
votes
1answer
516 views

List.indexOf does not exist?

I have an error in a method using List.indexOf. When running in anonymous window in sandbox, it works. But in production I get the following error: Method does not exist or incorrect signature: ...
4
votes
2answers
120 views

When (if ever) will testmethod fail to compile?

I just recently learned from the Apex Developer Guide documentation on the IsTest Annotation: The testMethod keyword is now deprecated. Use the @isTest annotation on classes and methods instead. ...
-3
votes
1answer
119 views

Inserting AccountTeamMember on Account

trigger AccountTeam on Account (after insert) { if(Trigger.isInsert){ for(account acct : Trigger.new){ if(acct.ParentId!=null && acct.VPA__c==false){ ...
2
votes
1answer
54 views

StateCode, CountryCode fields not available in SalesforceDX

I am trying to switch to DX but noticed that the CountryCode and StateCode are no longer being recognized by Salesforce in DX environment. Trying to reference those fields gives me an invalid field ...
7
votes
1answer
2k views

Method does not exist or incorrect signature: void contains(String) from the type List<String>

I cannot figure out why the following code (which is within a Test Data Factory class) would cause this error when validating in Production for deploy: Method does not exist or incorrect signature: ...
4
votes
1answer
111 views

Numeric input on VF page linked to value of a Map in controller

For one of the requirements I'm building a visualforce page with a controller. The problem is that I can not save the page with <apex:input> type being number. Compilation error is: Expected ...
2
votes
1answer
140 views

Compile all apex class order

Running into an error where dependent classes are invalid and need recompilation because no such column 'BillingAddress' on entity 'Account' exists. One recommendation was to create a class that pulls ...
0
votes
1answer
94 views

Batch test class not working!

I have managed to put together a batch test class using Trailhead, but it is not correct, all I need is for it to populate values in new custom fields with values in other fields all from the Account ...
4
votes
1answer
53 views

Are RecordType Static Resources not Allowed in Apex?

I get the following error when I try to save a test class with List<sObject> recordTypes = Test.loadData(RecordType.sObjectType, 'Record_Types'); "Method does not exist or incorrect signature: ...
0
votes
1answer
129 views

Lightning Component/Inner Class Bug after Spring 18 sandbox update [duplicate]

I have an existing Lightning Component, which is used in a lightning community. This component was version 39 on Friday. The following is a pared down example of the code (I just removed a bunch of ...
6
votes
1answer
110 views

JSON.deserialize() for User records wont work

I'm trying to deserialize a received user record on a JSON format. TO achieve this I'm using JSON.deserialize() but when I specify the User class the compiler throws the following error: Save Error:...
0
votes
1answer
252 views

Method must have a body

I get this error when I try to save the below class. Why? How do I fix it? Error: Method must have a body at line 3 column 27. public class visitController { public Sales_Visit__c visit(); ...
0
votes
2answers
218 views

Method does not exist or incorrect signature: void schedule(String, String, PotentialCustomer) from the type System

I get this error when I run the below code: Method does not exist or incorrect signature: void schedule(String, String, PotentialCustomer) from the type System Code: global class ...
-4
votes
2answers
175 views

How to solve Error: Compile Error: Field is not writeable error for ListPrice Field on opportunity Line Item

I am trying to assign the List Price field on OpportunityLineItem to 0 using trigger but receiving the Compile Error as: Field is not writable error. for(OpportunityLineItem oli: trigger.new) { ...
-2
votes
1answer
73 views

String List Used to reference String in Class

I am trying to use a string list and it's values to represent members of a class, but it is taking the variable literally and returns that the variable does not exist. Is it possible to reference an ...
0
votes
1answer
22 views

Passing value from test class to in vocable method?

I have create a invocable method for call from the flow. Now I want to create a test class. Apex Class: public static void Fee(List<Id> ids){ sample__c s= [select id from sample__c ...
-3
votes
1answer
190 views

How to concatenate a static value to a field?

I have a custom object (project) in that I've project name field(Text). Once I enter the project name, "fita" should be added to the end. For example, if I enter ABC for project name, then it should ...
0
votes
2answers
2k views

Deployment error - dependent.class.invalid not found

I am deploying salesforce components using ANT and I am seeing this strange error and don't know what exactly it means by. I have included all the dependent components. Please let me know if anyone ...
2
votes
1answer
102 views

How to initialise read-only instance property

I would like a read-only instance property in an Apex class, to prevent it ever being changed after instantiation. I can't work out how to initialise it. I would like to be able to write something ...
-1
votes
1answer
268 views

How to get current record id in wrapper class

I am trying add to add multiple objects in a list. So I created a wrapper list. I'm getting current leadid But when I try to add to wrapper list I get this error: Method does not exist or incorrect ...
0
votes
6answers
316 views

Error: Loop must iterate over collection: Boolean

I have an issue that I am hoping others may have come across and/or can quickly and easily point out what I have done incorrectly in the below sequence of code. I am receiving the error Loop must ...
-1
votes
2answers
94 views

Error Variable does not exist, get value from class in trigger

I want to get the return value from my class to my trigger but get the error Variable does not exist: currentUser? Class public class NavigateToContpersOpl { @AuraEnabled public static String ...
-1
votes
1answer
165 views

Save error: Illegal assignment from String to Integer

I need a string value transformed to a integer so that I can use it in a number field. Integer leadSize=(Integer.valueOf(email.plaintextbody.split('Base: ').size()) > 1) ? email.plaintextbody....