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.

-1
votes
0answers
19 views

Whenever account type is changed from any value to 'Customer' need to send an email to account owner

Trigger: trigger accouncustomertype on Account (before insert,after update) { accountcustomer.email_send(Trigger.new); } Error :Method does not exist or incorrect signature: void ...
0
votes
1answer
15 views

send email based on account type [on hold]

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
29 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 ...
-1
votes
0answers
29 views

How to create Apex test class for my trigger [closed]

I know nothing about programming and I have an Apex trigger. I can't get coverage using the basic company test class. I am guessing I need a different test class, one specifically for this Apex ...
0
votes
0answers
36 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
21 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
22 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
28 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
35 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
24 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
63 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
19 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
41 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
30 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
16 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
32 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
19 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
66 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
29 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
17 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
46 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
30 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
52 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
26 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
37 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
19 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
14 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
38 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
32 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 ...
0
votes
0answers
25 views

How to track stage of the opportunity record is not Closed-Lost (unless the stage was automatically set to Closed-Lost within the past 90 days

I am working on one requirement and I got stuck at one place. I hope someone will help me to resolve my problem and guide me in proper directions. My use case is as follows: SCENARIO 1: Close ...
0
votes
1answer
13 views

Why does my country returns null on creating an account?

I am creating a testdatafactory. creating a country goes well. When creating accounts my country fields are null if i debug CountryList it returns the created country record. Factory class @isTest ...
0
votes
2answers
36 views

How to build a testdatafactory without error : DUPLICATE_VALUE, duplicate value found: duplicates value on record with id: : []

I an trying to create a testdatafactory which i can use to call in my tesclasses. What I want to achieve is small buildingblocks with which I call another method if a lookupfield needs to be filled. I ...
1
vote
3answers
52 views

How do I stop this trigger from running more than once?

I'm still fairly new to Apex. Currently in our org we have a class called CommitmentProcess and a trigger called CommitmentTrigger. We use this to clone Opportunities that are up for renewal. So for ...
2
votes
2answers
38 views

Code coverage annotation for or statement next line or same line?

Ik have a class with several or statements. To make the code more readable I placed the or statements on a next line. My dev console shows that there is no coverage for these lines. Do I need to place ...
0
votes
1answer
27 views

Does an Apex Class run linearly (procedurally?)?

I am used to writing a run method in Java which specifies where the code runs. Outside of this nothing runs unless called. In apex there I don't see a run method. I'm guessing it starts at the top ...
0
votes
0answers
24 views

Zuoracoverage issue

How to cover this method as zuora callout is happening public boolean UpdateToZuora(string objName, map<string,string> MapZuoraValue , Zuora.zApi zApiInstance) { List<Zuora.zObject> ...
0
votes
1answer
98 views

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY - INVALID_CROSS_REFERENCE_KEY

I'm also getting a the following error from my apex test and trigger while validating. The error,test class and trigger are below. Run Failures: TestAfterPOLogUpdateTest.myUnitTest System....
1
vote
1answer
35 views

How to put a list in the parameter for class and use its variables?

I have a JSON and I need to pass the data to a list, then use it as my class parameter. I've managed to pass JSON to a List, but when I put it in the class, it throws the following error: "global ...
3
votes
1answer
29 views

Can a managed package query and list all the classes installed in a subscriber organization?

By querying the ApexClass object, one can list all the classes that exist within an organization. However, if the code which queries the classes is from a managed packaged, can it see all the records, ...
0
votes
0answers
30 views

pdf file is not showing in formula field as a image in My custom object file_name__c (field name(Content__c)) is this is possible or not?

public static void Savefile(id fileId,id familyHealthId){ PageReference pdfPage = new PageReference('/apex/FamilyHealthCardPdf'); pdfPage.getParameters().put('id',familyHealthId ); ...
0
votes
1answer
32 views

How would i write my map/soql query outside of the for loop?

public static void oppFldUpdates(List<Opportunity> newOpps, Map<Id,Opportunity> oldMapps){ Opportunity oldOpp = new Opportunity(); for (Opportunity newOpp :newOpps){ ...
0
votes
2answers
73 views

Populating field value of Case using Apex Class?

I'm trying to populate a lookup field through apex, though am currently testing by populating a simple text field after a form is submitted, activated through the process builder. Below is my code, ...
0
votes
0answers
122 views

Passing apex class as a parameter from lightning component to apex class

I want to pass apex class as a parameter from lightning component to apex class method.When I tried, I am getting error as "Error message: An internal server error has occurred Error ID: 124770038-...
0
votes
2answers
128 views

Basic Map And I am Stuck in FOR Loop [duplicate]

Here is my Map Map<id,List<Custom_Report_2__c>> mapreports= new Map<id,List<Custom_Report_2__c> >(); for( Custom_Report_2__c cr:cr1){ mapreports.put(cr....
1
vote
1answer
45 views

JSON content display : Attempt to de-reference a null object

I am trying to display content from a JSON feed on my Salesforce page using APEX/visualforce page. From information gathered, I am able to get the details of the JSON on variable. But when running the ...
1
vote
1answer
23 views

Trying to hide inputField - Visualforce Page

Im trying to hide my Billing_Account__c inputField on my visualforce page, If my custom field Entitas_New__c = 'Pusat' on my custom object Master_Visit_Plan__c. This is the vf page, as you can see ...
2
votes
4answers
330 views

System.LimitException: Too many DML statements

I want to mass update my account record. But I got this error when trying to deploy the code. public class Insert_CustID_Old { public void insertCustId() { List<Account> accList = [...
0
votes
0answers
17 views

How to create a new record if it does not exist, update quantitiy if it does in an apex class

I have this class that creates a custom object record when an opportunity is marked as "contracted" (Using CPQ). It looks at the OpportunityLineItems - compares what is there to another object that ...