Questions tagged [class]

A class is a template or blueprint from which objects are created. An object is an instance of a class.

Filter by
Sorted by
Tagged with
0 votes
0 answers
22 views

Batch Apex error: Method does not exist or incorrect signature: void executeBatch(LeadProcessorTest) from the type Database

I'm working on the Use Batch Apex trailhead module and am getting an error on deployment. force-app\main\default\classes\LeadProcessorTest.cls Method does not exist or incorrect signature: void ...
user avatar
0 votes
0 answers
15 views

Record Duplication - Unable to Determine Root Cause Based on Debug Logs

Recently inherited an org an am completely lost because of code coupled with process builders that bypass the code and flows that bypass the process builders. There is intermittent record duplication ...
user avatar
  • 1
-1 votes
0 answers
39 views

getting" unexpected token: from" error in below test class [closed]

@istest public class DateMathHelperTest { @isTest static void DateMathHelpermethod1() { Epix_Date_Math_Logic__c edml = new Epix_Date_Math_Logic__c(); //edml.name = 'test'; edml....
user avatar
-1 votes
0 answers
22 views

Cannot find apex-defined data type class in flow

I am having an issue. I need to use the any data type in my apex class to use in my salesforce flow. However with the following code, I cannot find the apex class in the flow builder when creating the ...
user avatar
-2 votes
0 answers
29 views

Constructor not defined: [GenerateGLpostingBatch].<Constructor>()

I'm trying to delete a trigger (a simple task) but for some reason, I keep receiving the following error no matter how I delete/amend the trigger. Constructor not defined: [GenerateGLpostingBatch].<...
user avatar
0 votes
1 answer
46 views

Apex Class CallOut

I'd like to apologize in advance as I'm quite new to writing APEX Classes / Triggers. I've followed a tutoriel of which the aim is to POST a comment to an external system, in this case it's Jira. I ...
user avatar
-2 votes
0 answers
27 views

test class this batch with Trigger [duplicate]

Sorry how can i create a test class for these related classes? batch code : global class CreateRicontatto implements Database.Batchable<sObject> { String campaignId; global ...
user avatar
  • 1
0 votes
0 answers
41 views

Batch test class passing but not covering execute method

public with sharing class ContractBatch implements Database.Batchable<sObject>,Database.Stateful{ public Database.QueryLocator start(Database.BatchableContext BC){ return Database....
user avatar
  • 1
0 votes
0 answers
14 views

Hi i have to write test class for following trigger handler class? can anyone help me in same. Code is mentioned below [duplicate]

public class ActionsToBeTakenTriggerHandler { public static void handleAfterUpdate(List<Actions_To_Be_Taken__c> atbtList, Map<Id, Actions_To_Be_Taken__c> oldMap){ if(atbtList !=...
user avatar
-2 votes
0 answers
11 views

How to write test class for this schedulable class? [duplicate]

global with sharing class pokeBatchList implements Schedulable{ global void execute (SchedulableContext SC) { List<Pokemon__c> pokeList = new List<Pokemon__c>(); for(Integer i=1; ...
user avatar
0 votes
1 answer
39 views

Show popup with confirmation button using addMessage and commandlink

I have a requirement where I have to create a popup (using addMessage) that display two options: confirm and cancel, each of these options has an action. I already tried passing a command link in the ...
user avatar
0 votes
0 answers
36 views

CLass apex to check if record junction object exists

I am new to the apex world, I should create an apex class that allows me to check if there are Records of a junction object in the Account if there are I have to take the product that is related to ...
user avatar
  • 1
3 votes
2 answers
83 views

Create an reactive auxiliary class in the LWC component

I've tried to create auxiliary classes in the component folder to divide logic into smaller parts, but I can't make the data on the page refresh. for example: Example file structure: component/ |-...
user avatar
  • 31
0 votes
0 answers
29 views

Failed to invoke future method error

I am constantly getting an email with the error below.  I have tried changing the setTimeout value and that does not seem to work.  I am not sure if it is the code that is causing it or maybe the ...
user avatar
0 votes
1 answer
31 views

Test Class Not Covering Return [duplicate]

My test class doesn't seem to cover any of the return methods within my apex class, therefore only giving me 69% code coverage, and I can't deploy into production. Apex Class - Main public with ...
user avatar
  • 1
0 votes
1 answer
29 views

Data is not retrieving in a set. Help me I am New to Apex

I am new to Apex. When I query Accounts in a List it shows all the records in a list without for loop. But When I query the same in set, it only shows One record. When I Check Size of the set, it ...
user avatar
-1 votes
1 answer
28 views

I am unable to insert 10000 records. Getting Too man query rows error

public class CreateBulkAccounts { @future Public static void method1() { List<Account> acList = new List<Account>(); for(integer i=0; i<10000; i++) ...
user avatar
0 votes
1 answer
43 views

Need to insert New Event Date and time in Account Field (Event Date Time (manually created)) through Apex Class/Trigger [closed]

I am trying to insert New Event Start date/time and End date/time in Account object field (Event Date Time). Please help me to trigger code. Once New Event created, the Start Date/Time & End date/...
user avatar
0 votes
1 answer
69 views

Visualforce display a related list from a lookup field on a custom object

I am quite new to salesforce/coding and got myself stuck on a stumbling block when developing object for our internal use. I have and object called Inventory_Skid_c this object has a field called Skid ...
user avatar
  • 5
0 votes
0 answers
24 views

An error occurred in the apex test class [duplicate]

i have to pass the test class but the error is not resolving iam not bale to find the error can you please help what i have to do to pass this test class "message": "Method does not ...
user avatar
  • 1
0 votes
1 answer
32 views

Apex Wrapper class instance field order

// I have a wrapper class like: public class classWrapper { public A A_ITEMS; public B B_ITEMS; public C C_ITEMS; } public class C { public List<CItem> item; } public class ...
user avatar
-3 votes
1 answer
27 views

Illegal assignment from List<String> to List<Order> (4:21)",

Im having this issue which I dont understand. Any advice?
user avatar
-2 votes
1 answer
44 views

Coin Change program in apex

Edit: Figured it out , thanks for help. public class coin { public static Integer amounts(Integer[] coins, Integer amo) { Integer[] dp = new Integer[amo+1]; for(Integer k = 0; ...
user avatar
  • 1
2 votes
2 answers
93 views

Lombok for Salesforce Apex

I'm looking for some solution, which helps me to write less code in Apex. Is there any tool like Lombok for Java.
user avatar
0 votes
1 answer
26 views

Test Class code coverage ( only couple of lines )

Hello this is the first time i try to write a test class, but i don't understand exactly how i can test if the flow was actually launched. Can someone help me with the test class ? It's only a couple ...
user avatar
2 votes
1 answer
77 views

Throw Error on Two Record Merge

I'm working on a requirement where I need to stop contact merge if the child record associated with both of them are same. I have written a before delete trigger on Contact, but I'm not getting ...
user avatar
0 votes
1 answer
56 views

Apex Test Class Fetching Article Details

I need help with writing an apex test class for a class that fetches article titles and article descriptions. Class for example: global class FetchingArticleDetails{ global List<(API name of ...
user avatar
  • 3
0 votes
1 answer
139 views

Help with Parent-Child relationship in apex class

I created the following trigger. trigger Update_Case_Subject on Case (before insert) { for (Case c : trigger.new){ c.Subject = RecordType.DeveloperName + ' - ' + Account.JA_Account_ID__c + ...
user avatar
  • 1
0 votes
1 answer
142 views

covering test class if condition for a variable defined in method

public static String myMethod(String vehicle1){ string abc = 'car'; if (abc == 'bike'){ // lines of code } } Here the issue that I am facing is that the lines of code inside the ...
user avatar
0 votes
2 answers
156 views

Whats wrong with my Apex Class? It throws ERROR Please reference your WSDL or the describe call for the appropriate names

In Execute Anonymous it works fine Code: List<Room__c> c=[SELECT id,Name,Customer__c FROM Room__c]; System.debug(c); But in Apex Class it throws an error as Didn't understand relationship '...
user avatar
0 votes
1 answer
108 views

Enterprise Territory Management (OppTerrAssignDefaultLogicFilter) Test Class Error

I am in the process of implementing the territories within Salesforce and was following the instructions and sample code from the help documents here: https://developer.salesforce.com/docs/atlas.en-us....
user avatar
  • 5
1 vote
0 answers
45 views

update sobject class

I'm trying to update sobject from one to another sf org. I import my custom wsdl sobjectEnterpriseSoapSforceCom and sobjectEnterpriseSoapSforceCom, i pass login but i cannot able to update an sobject. ...
user avatar
  • 11
7 votes
1 answer
156 views

What is the best practice regarding organizing Apex code

I am just curious of what is the best practice, it seems that if I create folders in force-app/main/default/classes and put my classes there everything seems to work fine. Is this in any manner bad or ...
user avatar
0 votes
1 answer
50 views

Trigger to compare records in different Objects not working as expected

I have refered the following thread to solve my problem. Not sure where I am going wrong. Compare records with same field value from different Objects in apex? Here is my attempt: PROBLEM: While ...
user avatar
  • 55
0 votes
0 answers
40 views

Attempt to de-reference a null object but no issues found in the class

I have a Class1 and then there is another Class1_Handle. The Class1 takes a list of OPP, then loops through that and sends Opportunity ID to the Hadelar 1 by 1. The Handler then does a bunch of stuff, ...
user avatar
2 votes
1 answer
451 views

Error on Trigger: Method does not exist or incorrect signature: void CheckPreviousYearEntryByPhoneNumber(list) from type FreeWaterSchemeClass

Problem statement: If the customer phone number was enrolled in free water scheme for 2020, status field in 2021 scheme object should ''You cannot avail this scheme in 2021, as you have already ...
user avatar
  • 55
0 votes
3 answers
76 views

Is there any way we can identify the insertion/updation of record is happened through UI or not

I have requirement where I have one trigger and its calling handler and in handler i have one method, I need to run that method if I am updating the record through UI in,i dont want to run trigger or ...
user avatar
  • 1
0 votes
1 answer
348 views

Update field using Apex

I am very new to Apex and found this site- hoping someone can help me out. We have a LOT of code-free automation on our cases and related objects, so we had to resort to Apex classes to do a few ...
user avatar
0 votes
1 answer
318 views

Add data to query results to LWC

hoping i can get some help on this one: I have an Apex class where im running a SOQL query: public with sharing class TestClass { @AuraEnabled public static List <sobject> getFreqLWC(String ...
user avatar
0 votes
1 answer
218 views

Enable Map type to hold Integer, String, Boolean, Map, List... objects? (But not generic Object)

I'm attempting deserialize a list of a custom object in Apex, but got an error: FATAL_ERROR System.JSONException: Apex Type unsupported in JSON: Object This is because my ContactPostBack class ...
user avatar
  • 9
5 votes
2 answers
520 views

How can I extend the `Set` class?

Is there any way I can extend the Set class? I have numerous places in code where if I a set has no items, I want to add all the items in another set, but if it does have items, I want to retain only ...
user avatar
  • 663
2 votes
1 answer
617 views

No viable alternative at character " "

Second day of being a coder and I'm getting this error... line 1:70 no viable alternative at character '"' Error is in expression '{!search}' in component apex:commandButton in page ...
user avatar
-2 votes
1 answer
97 views

Why isValid is true but failed to deploy with error 'Dependent class is invalid and needs recompilation'?

Why isValid = true but even though still failed to deploy with error 'Dependent class is invalid and needs recompilation'? When I run query Select Id, Name from ApexClass where isValid = false it ...
user avatar
0 votes
1 answer
46 views

Pointers on writing test class for ApexPages.StandardController Controller

I have the following Apex Class that I need to write a test class for. I've never done this before and rather new at this. Can someone offer pointers for this test class? public class ...
user avatar
  • 33
0 votes
1 answer
388 views

how I insert JSON data into Apex class [duplicate]

I have a question about convert the JSON to class and insert and see the Data from standard Account Salesforce (account, contact) This is the serialized data { "conList": [ { &...
user avatar
0 votes
1 answer
277 views

AuraEnabled function gets not value from lwc using class type as parameter

i have the following object: public class myType { public String name {get; set;} public String fields {get; set;} public Integer page {get; set;} public Integer pageSize { get; set; } } ...
user avatar
0 votes
0 answers
43 views

Test class for Messaging.SingleEmailMessage [duplicate]

I wrote a batch class that send the records in email notification with schedule The batch works, but I'm still struggling to write a test class that will get a high code coverage (currently I get 63%)....
user avatar
0 votes
1 answer
35 views

Validate duplicate records in list

I am working on deleting duplicate child records on contact merge. Example: I have a contact C1 and C2 : (C1 has A,B,C records and C2 has A,D,E) records and now record A is the duplicate with same ...
user avatar
  • 11
0 votes
0 answers
16 views

2GP: the same class name in 2 packages with the same namespace [duplicate]

We have 2(2GP) Packages for example "A" and "B" on the one namespace for example "pkg2". In Package A we have an apex trigger with the name "ContactTrigger" and ...
user avatar
  • 11
1 vote
1 answer
141 views

Checking Equality in Lists of Apex Classes

I am writing tests for a flow utility and have been failing tests due to Salesforce by default comparing custom class instances by reference instead of values. I added an equals method to my output ...
user avatar

1
2 3 4 5
21