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
0answers
23 views

how to retrive current quarter and previous quarter data by batch class

I have cycle plan object in which I just want to keep previous quarter n current quarter data other quarter data should be deleted.how to solve this problem by using batch class. Anyone help will be ...
-3
votes
0answers
22 views

this is my apex class help me to write test class for this,thanks in advance [duplicate]

public static decimal Httpmethod(decimal USD) { Http http1 = new Http(); HttpRequest req1 = new HttpRequest(); req1.setendpoint('https://api.exchangeratesapi.io/latest?base=USD'); ...
1
vote
1answer
41 views

How can I save a class when a batch job is running (without the Ant tool)

I am trying to figure out if we can save a class which is used in a batch job. I am unable to save a class. I can't save the class when a batch job is running. I don't want to abort the job. Is there ...
0
votes
3answers
45 views

Change account owner of Opportunity if it meets criteria in Apex Class

I've written an apex class to update all Opportunities which meet a certain criteria. I understand how to change the fields values on that specific opportunity, but am confused to how I would change ...
1
vote
1answer
33 views

How user is able to Update Record

I have a custom object whose OWD is Public Read/Write and the profile of user has Read and View All permission for that Object. Now I have a Custom Button on that Object using Aura component I'm ...
1
vote
1answer
29 views

Schedulable Apex Class to update fields in Lookup record

I have a Custom (Managed) object called Individual Email Result (et4ae5__IndividualEmailResult__c) which contains a Lookup field to a Contact record (et4ae5__Contact__c) and I want to create a ...
2
votes
2answers
127 views

Push a custom string in a SOQL result

I'm not really sure if this is possible because i'm newbie but, can I push a custom string into a SOQL result? I tried this code multiple times and i also modified it but i can't get the result i ...
-3
votes
1answer
24 views

Need help Schedule Test Class for tast create on Opportunity

I need help on the test class for this schedule on Opportunity. Getting error on below code with comment and only 35% coverage code. global class OppJob_Task_1stPhoneFollowup implements Schedulable { ...
0
votes
1answer
39 views

I have written a trigger and class to first create an account and then 10 identical opportunities. It is working but only creating 1 opportunity

trigger IdenticalopportunityAccount on Account (after insert) { List<opportunity> oppt = new List<opportunity>(); for(Account acctOpp1 : Trigger.new) { if(acctOpp1....
0
votes
1answer
40 views

Using HttpResponse in a seperate class from future

I have written a trigger that calls a class which contains a future method and I need to use the response to update a field. Is there anyway to capture the HttpResponse in a separate class? public ...
0
votes
0answers
37 views

Apex Trigger Error

Here is my Apex Class: public class NavProductHelperClass { public void checkProductAvailability(list<OpportunityLineItem> opids) { for(OpportunityLineItem oli: opids) { ...
0
votes
0answers
38 views

Picklist field value being mapped does not display on original object but does display on mapped object - change code to show on both - how?

I am still learning and have created this code that triggers when: On Enrollment (custom object) When the user changes the enrollment status (picklist field) to 'graduated', it populates the ...
1
vote
1answer
47 views

System.TypeException: Procedure is only valid for System.DmlException and System.MailException

I am trying to send an object(Account) as a parameter from my batch class, I am getting this exception. FATAL_ERROR System.TypeException: Procedure is only valid for System.DmlException and System....
0
votes
0answers
20 views

How to write a test class for the below mentioned trigger (code) [duplicate]

trigger IdentialContact on Account (after insert) { List<contact> cont = new List<contact>(); for (Account acct : Trigger.new) { for (integer i=0 ; i<2 ; i++) { ...
0
votes
0answers
26 views

Deployment Failed Developer Edition

I can't save a class in a developer org. I receive this error: "Can't alter metadata in an active org". How can I resolve this problem?
1
vote
1answer
29 views

Variable does not exist: hed__End_Date__c

public class UpdateGraduated { public static void WhenGraduatedUpdate(List<hed__Program_Enrollment__c> enrollmentListUpdate){ try{ List<hed__Program_Enrollment__c> ...
1
vote
2answers
61 views

Attempting to pass current record's ID from trigger to Class

Code novice here! I am trying to pass the OpportunityContactRole's Opportunity ID from a trigger to a class to a Flow. I would happily use a Process Builder to trigger the Flow but OCR's are yet to ...
-2
votes
1answer
33 views

How to exclude classes and triggers from change set validation

I'm validating a change set and getting the code coverage error stating your orgs code coverage is less than 75% i do not want any apex classes, testclasses, triggeres to be run while validating a ...
0
votes
1answer
19 views

Static method cannot be referenced from a non static context - Test Class

I'm trying to write a test class for this class but not sure how to provide code coverage for what I'm doing here. In my class I'm just running a query, looping through the query and creating a list ...
2
votes
1answer
42 views

I'm trying to create an APEX Batch Class on custom object, but getting an error

Getting an error when trying to create this batch class. Could you advise what I'm doing wrong? Error: Compile Error: Class LocationProcessorBatch must implement the method: void Database.Batchable....
0
votes
0answers
52 views

Create test class to achieve 75% code coverage needed for a Apex Trigger and Class [duplicate]

I wish to update a field from one custom object (Career Path) to another object (Contact details) based on whether a checkbox (Current) is true. Essentially, it updates the Contacts details with the ...
0
votes
1answer
27 views

Apex: Use one test class in another test class

I am working on some email automation and I have a separate test class for each language, kind of like this: @isTest public class EnglishEmailTest { @isTest public static void test1() { .....
1
vote
1answer
30 views

Apex Trigger error when updating child record

I'm very new to triggers. The following trigger updates a custom field in a custom object (Events__c) with the sum of all "TotalPrice" from a related object (OpportunityLineItem). I'm getting the ...
0
votes
1answer
26 views

System.ListException: List index out of bounds: 0 Stack Trace: Class. line 33, column 1

I am trying to use rollup help enable real time. To do this the app (rolluphelper) wants to install a trigger and a class onto the opportunity object. But in deployment it fails with the following ...
0
votes
0answers
12 views

Retrieving and Deploying an Apex class with an older managed package version

In our testing org. I have a class that doesn't function correctly within our org when on the latest version, in fact a managed package needs to be downgraded for the issue to disappear. 7.27 -> 6.96 ...
-2
votes
1answer
40 views

how to write a test class for web service HttpPost

I'm new to development here I'm developing a webservice in rest and I have no idea about how to write a test class for that. Please find the below code of apex class: @RestResource(urlMapping='/...
0
votes
1answer
57 views

Creating test class for apex (reports namespace) used in Flow action

I have a Flow which calls an apex class (via action). The purpose of the action is to grab a list of Lead Id's from a specific report. The reportID is passed to the class from the flow. Then, the ...
0
votes
0answers
27 views

Need Help with a test class to my apex class that attaches a Visualforce Page pdf to the quote [duplicate]

I found a way to write an apex class that attaches my quote which is generated by an vf page as a pdf to my quote object. Writing the test class is even a bigger problem for me. I get to 36% coverage ...
0
votes
1answer
43 views

Execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Class.Battle

I would like to create a trigger to activate when using the Battle class and its battle percentage method, but it gives me a "activate percentage: execution of BeforeInsert caused by: System....
0
votes
0answers
42 views

Is there a way to hard delete an Apex Trigger when there is no Apex Class?

I had a developer work on this before myself, so I'm working backwards. I've been able to get all the coding I needed for my org, however, now I have two Inactive Apex Triggers sitting in the Sandbox ...
0
votes
2answers
45 views

Error: Compile Error: Method does not exist or incorrect signature: void ceiling(Integer) from the type System.Math at line 19 column 36

Error: Compile Error: Method does not exist or incorrect signature: void ceiling(Integer) from the type System.Math at line 19 column 36 Trying to add an integer for week of the year into class ? ...
0
votes
2answers
35 views

Setting Invocable Variable value for a Test Class

I'm having difficulty finding a way to write the syntax to set my invocable variables in the test class: Here's the code. global class EmailPreventivoAccettato { global class Parametri { @...
1
vote
1answer
36 views

Help with “Duplicate id in List”

I've recently started at a new company with a completely different instance. Recently I've noticed a growing amount of errors looking like CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: CaptureCard_Trigger:...
1
vote
1answer
43 views

Test Class for Business Hours Check

I am trying to build a test class for my new trigger and part of the trigger is to check current time against the org business hours then set it as a boolean yes/no. Code: DateTime now =system.Now();...
0
votes
0answers
14 views

Apex Code Coverage for if/else if test class [duplicate]

if (userList.size() > 0 ) { String profileName = userList[0].Profile.Name; if (profileName == 'CP_CorporateAdminUser' || profileName == CP_SystemConstants.CORPORATE_OPERATION) { ...
0
votes
2answers
38 views

Confusion regarding save order of execution

I have created a number field in the contact object and created a trigger which is adding one number to the number field, a workflow doing the same, and a process builder doing the same now I have ...
0
votes
0answers
34 views

Messaging.PushNotification : change structure of payload

I'm building an app on iOS and Android using react-native without the Salesforce Mobile SDK. I want to be able to send Push Notification to the app using Salesforce PushNotification class in Apex. ...
0
votes
2answers
52 views

Extracting Dynamic String from a String

In the below Email body, I need to grab the External Account Id (4891 in the below example), however, that text can be between 4 and 8 characters long. Once I have the ID I'll find a matching account ...
0
votes
1answer
73 views

Enable Default Email Templates in Case Feed is not working

I am trying to enable the default email template selection logic as per the salesforce provided document - https://help.salesforce.com/articleView?id=case_interaction_default_templates.htm&type=5 ...
0
votes
1answer
49 views

Modal content not displaying correctly

I am creating a lightning component that pops up from a button on Opportunity. In this lightning component I am using multiple recordEditForm tags that are just outside tab tags. When setting the ...
1
vote
1answer
58 views

How to select the language of a custom label in Apex Class

I have an Apex class which sets the subject and body of an email using custom labels. The new requirement is to set this text per the language selected using a picklist field on Quote object. For ...
0
votes
0answers
23 views

Need Help for Apex Test Class [duplicate]

i have a problem with test code coverage of my trigger: that's the code: public class OpportunityLineItemTriggerHandler{ public static Boolean isTriggerFire = true; public static void sync(Set<Id&...
0
votes
2answers
124 views

Combine two different PDFs in single Visualforce page?

I have used below visualforce code to display two pdf in a single page but in the result, I am getting two different PDFs with two sections with iframe. Is it possible to combine these two PDFs in ...
0
votes
1answer
47 views

How to deep clone a batch class?

I have tried deep cloning on the opportunity object which has closed won stages it will also clone the Related Products I have tried cloning the opportunity and it works okay,how will i deep clone it?...
1
vote
0answers
27 views

Populate a Lookup Field Upon Record Creation

I am trying to create a trigger that will populate a lookup field on a custom object called Levvel Forecat. The basic criteria here is that when a new Levvel Forecast record is created with a ...
3
votes
3answers
83 views

Apex more than 50 Queueble jobs

I have this class that call a Queueble job more than 50 times in a loop. I recive the error: Too many queueable jobs added to the queue. The limit is 50. Here is the class: global class ...
1
vote
1answer
141 views

LWC: Can I have an expression and a string as a class combination?

I have a div and I want to assign one css class statically and one dynamically. Something like this: <div class="my-class + {dynamicClass}"></div> However that is not working and I am ...
4
votes
1answer
58 views

Need help in optimizing the below helper class

Logic : For any new record inserts for 'Properties' object, check if its Account_Ref_Ext_ID__c equals to 'Account' object's Chris_Account_Number__c. If it matches, assign Account id to properties ...
1
vote
2answers
393 views

LWC: Removing a class name on scroll

I am trying to remove a class name once the user has scrolled a certain amount. In my JS file for a LWC I have the following: import { LightningElement, wire, api, track } from 'lwc'; function ...
0
votes
1answer
47 views

Scheduling Flow

I am trying to create a screen flow that is scheduled in Salesforce. From the screen flow I call an Invocable method where I pass my input parameters from my screen flow. From there I call a future ...