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

Questions tagged [class]

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

0
votes
1answer
23 views

Why is (Trigger.isInsert && Trigger.isAfter) not firing when running test class?

THE PROBLEM: My CustomObjectTrigger has a CustomObjectHandler class. I have code that is fired in the CustomObjectHandler class when the CustomObjectTrigger is fired by a new record that (isInsert &...
2
votes
1answer
21 views

Trigger unexpected behaviour when used in bulk but not in single update

I have a trigger in the contact (before update and insert) that when a boolean field is true (in insert) or when it changes from false to true (in the update) it goes and find all the opportunity ...
1
vote
1answer
30 views

Help with Number to Text class

I have two fields. I need to be able to convert a number to text. Client_Value__c Client_Value_text__c I found the following code, but dont know how/where to put the api names in the code. Any idea ...
2
votes
1answer
28 views

Serial/sequence number in Platform Events fired

(Sorry for the long description but I promise it will compel you to put on your thinking caps) We have a scenario wherein we have several platform events to which external systems within my ...
0
votes
1answer
16 views

How to calculate the start date and end date of next week based on current date in apex

Formula to get the start date and end date of next week based on current date in apex.
3
votes
3answers
28 views

Trigger unit test or integration test

I have written some apex triggers along with some classes. The triggers are quite small because all the real work happens in the classes. trigger MyAccountTrigger on Account (after insert, after ...
1
vote
1answer
48 views

Start apex class after 30 minutes

I need to run a class in apex 30 minutes after updating a custom field of custom object, what can I use?
1
vote
2answers
38 views

Cover Error Handling on Test Class

I am having an issue where I have a trigger that rolls up data from contacts to an account. This was working fine with no issues until we added a managed package app that is constantly checking and ...
2
votes
2answers
53 views

How to access Class members decorated using { get; set; }

I'm trying to save on boilerplate code so tried to use { get; set; } idiom, but the function will not resolve. This is the class with decorated properties. public class Counter { private static ...
0
votes
2answers
42 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: ...
1
vote
2answers
143 views

Error: Future method cannot be called

Getting the error below while introducing a new app. The new app is attempting to update all accounts and this is happening. Most likely because it is maxing out the callout limit. I can deactivate it ...
1
vote
2answers
36 views

How to use trigger design pattern: ERROR Constructor not defined: [CaseTriggerHandler].<Constructor>()

I am trying to follow the best practice design patterns for triggers but get the error Constructor not defined: [CaseTriggerHandler].(). What am I missing? Trigger trigger CaseTrigger on Case (...
0
votes
1answer
45 views

Help with some code, Apex class not running when I think it should

Hey guys I have an issue I'm hoping you can help with. I'm a little new to Apex but figuring it out (I think). I have a really awesome unmanaged package that assigns leads/cases and it works great on ...
0
votes
1answer
24 views

Any pattern for merging fields of multiple objects of same type

I have a class called Texttypes and TextRoller as shown below: public class TextTypes { List<String> goodTexts = new List<String>(); List<String> badTexts = new List<...
0
votes
2answers
37 views

Bulk data loader operations:: System.LimitException: Too many SOQL queries: 101

I am getting an error while performing data loader operations on the Leads object as I get this error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:LeadTrigger: System.LimitException: Too many SOQL ...
0
votes
1answer
28 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
1answer
27 views

Assign case to the least occupied person in team [closed]

I have a requirement to assign the cases based on the user's capacity in a specified group. There are 20 users in a team. I need to check the capacity of the user whose capacity is less than other, ...
0
votes
1answer
18 views

How to get the updated specific record from list (Visualforce)

Im trying to get only the updated record from my current list.. Im using apex pageblocktable to show the current list, which is the contact field is empty (those data`s are from API response).. and ...
0
votes
1answer
23 views

Calling the trigger by class Method

I write a trigger on case for avoiding duplicate case by updating case status to "Duplicate". This Duplicate is manually inserted in picklist. I have to write Helper & Test class for this. Class ...
0
votes
2answers
18 views

APEX: Can't add instances of a custom class as elements of a list within a complex class

When I try to initialize an instance of the daisychain class below, using the makeDaisyChain method, I get a "System.NullPointerException: Attempt to de-reference a null object" error. ...
4
votes
3answers
122 views

Adding a Wrapper Class to an External Class

I am confused about what is happening in a small section of some code. I have a class that has a wrapper class inside it. There is an external class that calls this wrapper class Models.add(new ...
0
votes
1answer
19 views

send email based on account type [closed]

when ever account type is changed form any value to 'Customer' need to send an email to account owner saying your account become customer and create a task and assign it to account owner.
0
votes
2answers
30 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
0answers
64 views

Schedule apex class to run every day

I want to make some rollups on a custom objects via a scheduled Apex class. I managed to test the rollup via an Apex trigger, which fired whenever I edited the custom object. Now I want to run it ...
0
votes
1answer
35 views

Delete last 30 days data using batch class not working

i have been trying to delete last 30 days records through batch class, i am not getting any errors. i don't see my records were not deleted while i run the batch job, please advice. thanks in advance.....
-2
votes
1answer
23 views

when i test my trigger the error will shows Given below

Everyone When I test my trigger class the error will shows Given below System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are ...
0
votes
2answers
32 views

Running an APEX class in Production, how to add isTest to APEX code

I'm trying to learn about apex test classes, I have attached the below code. I can't execute this in production developer console, but works fine on my sandbox. I was asked to write a @isTest, is this ...
0
votes
1answer
44 views

Recieving the following error while trying to comment out Apex Trigger: “Error: Compile Error: Unexpected token '<EOF>'. at line 65 column 1 ”

I'm a point and click admin with little Apex experience in need of some assitance. I am attempting to Comment out and Apex Class in my Organization, however when attempting to update the Trigger in ...
1
vote
1answer
12 views

Avoid specifying an outer class when using its nested class outside

How can I avoid specifying an outer class when using its nested class outside the outer? For example, I have the following: public with sharing class ClassA { public class NestedInA { } } ...
1
vote
1answer
25 views

Possible to delete dependent classes

We remarked a little strange issue in APEX. It is possible to remove a class, which is called in another class. Has anyone had the same issue? Main class: public with sharing class MainClass { ...
1
vote
2answers
67 views

Cannot move query outside of FOR loop?

REQUIREMENT: Need to move the query outside of the FOR loop in Opportunity trigger. PROBLEM: After moving query outside of the FOR loop, I receive an error when trying to save a new Opportunity ...
0
votes
1answer
20 views

Error While Saving the Class [closed]

Error: Compile Error: Variable does not exist: lstOppotunityToUpdate at line 34 column 17 Code: public class QuoteLineItemTriggerHandler { public static void syncQuotes(List<QuoteLineItem&...
0
votes
2answers
49 views

Calling a Class from a Trigger (calls external service)

I am at my wits end with Future Methods coding and would be very grateful for a working example. I've been reading through the Future Methods documentation here: https://developer.salesforce.com/docs/...
0
votes
1answer
46 views

Invalid conversion from runtime type ERROR

I'm trying to parse json response.. but keep getting this error Invalid conversion from runtime type List ANY> to Map String,ANY> Map<String, Object> MapLv3 = new Map<String, Object>()...
0
votes
1answer
17 views

Cant get the 1st row from JSON Parsing array

Im trying to get the participants data from API response.. //Level 1 Map<String, Object> MapLv1 = (Map<String, Object>) JSON.deserializeUntyped(parser); ...
0
votes
2answers
34 views

Using While loop for API callout

Im trying to test if I can request an API without timeout or reach the sfdc api callout limit.. I want to loop the request because the API only show the response for the 1st 25 records of each page ...
0
votes
2answers
28 views

Error Method does not exist or incorrect signature

Getting the following error at line number 7. Method does not exist or incorrect signature: void add(Auto_Risk_Fill__c) from the type Map List<Auto_Risk_Fill__c> autoValues = new List<...
4
votes
1answer
100 views

Batch Apex: [REQUEST_RUNNING_TOO_LONG] - can I optimise my class?

I've written a batch class that grabs order ID's using a selective query in a QueryLocator method. I then execute my batch by running a SOQL for loop to get and update relevant big object records that ...
0
votes
2answers
36 views

How to deserialize json list, error: Invalid conversion from runtime type List<ANY> to List<or_leadsJSON>

I an trying to deserialize a Json string to use in my callout but get the error Invalid conversion from runtime type List<ANY> to List<or_guestsJSON> Callout HttpResponse response = ...
0
votes
0answers
22 views

How do I use Process Builder to populate a text area from a list?

I have a custom object in which I'd like to build a text area with concatenated values from a list of products, without using an Apex trigger (if possible). My custom Object, CourierBooking__c, ...
1
vote
1answer
92 views

Parsing Using JSON2Apex

Im trying to use the JSON2Apex to get the parsing class for my API response.. I only need the metrics data for each userId, but I cant get the variable and the system always giving error Variable ...
-1
votes
1answer
70 views

Test Class/Method for TriggerHandler - Negative scenario

For this class below, which essentially counts the number of Open cases on an Account, on update/insert/delete of a Case, can anyone help me write/provide a scenario of a test method that can hit the ...
0
votes
2answers
60 views

Learn Parsing JSON

Im trying to get values from API request.. there`s 2 user data from the response and I want to get the data of each user and put it on the list.. but my code only store the last user data from the ...
0
votes
1answer
27 views

Need Help with a custom Setting

i have a custom setting with a field type "checkbox" set to true but if i try to query it on a class it's allways returning false, i don't know why. Email_Engine__c ee = Email_Engine__c.getInstance();...
-1
votes
1answer
38 views

My test class keep failing. Moving the rev scheduler with the close date

Im not getting any coverage with this test class. YOu'll see the trigger and the class handler are here. ============================================================== @isTest private class ...
1
vote
1answer
21 views

need to avoid firing trigger on perticular api invocation

I have written one trigger which fires on account create and update,but there is one API which creates/update account and if creation/updation is through that API i don't need to fire trigger. Please ...
0
votes
1answer
19 views

Maximum stack depth reached: 1001 inner class

I'm trying to export record on into a tab separated text file. In getting Maximum stack depth reached: 1001 in the inner class where i'm doing the piece of code and I have pasted full code in the ...
0
votes
1answer
39 views

'Last Viewed By' Account field test - System.QueryException: unexpected token: 'null'

Trying to create a Last Viewed By field on Account. I'm newbish at Apex and not seeing what I'm missing here... I'm sure it's a rookie mistake. Adapting code from http://www.sfdcpanther.com/setting-up-...
1
vote
1answer
42 views

Apex Inputtext not getting assigned to variable in apex controller

I have below pageblocksectionitem in VF Page. <apex:pageBlockSection showHeader="false" columns="2" id="blockseciframe" > <apex:pageBlockSectionItem > <apex:...
0
votes
1answer
33 views

OrderTrigger: execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object

I got stuck at one place on one of my requirement on which I am working on. My use case is as follows: SCENARIO 1: Close Opportunity when Upgrade Order is cancelled GIVEN a a person account record ...