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
11 views

Helper & Trigger Testing Assistance [duplicate]

I am using a similar format for a trigger and helper class. Can anyone help me with a test class? Trigger Trigger TestOrders on Order (Before Insert) { IF(Trigger.IsBefore) { IF(...
0
votes
1answer
20 views

07:40:24:023 FATAL_ERROR System.StringException: Invalid id: a610V0000015C5DQAU

public void updateattendeecb() { System.debug(enteredText1); Id myId = Id.valueOf(enteredText1); list_attendees1=[Select id,Send_Email_for_Certificate__c from EM_Attendee_vod__c where id= :...
0
votes
1answer
27 views

how to write test class for batch class ? this covers only 44% [duplicate]

how to write test class for batch class ? this covers only 44% global Class Batchsample implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database....
0
votes
0answers
28 views

Error INVALID_CROSS_REFERENCE_KEY in test class when deploying to production

I'm getting this error System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: [] Stack Trace ... This production org is ...
0
votes
0answers
6 views

Make It Easy for Users to Find Paused Flow Interviews for a Record - Test Class

Has anyone successfully created a test class for this? https://help.salesforce.com/articleView?id=flow_pause_cmp_record.htm&type=5
1
vote
1answer
68 views

Confused with how the Protected access modifier works

I have a virtual class with non virtual and virtual methods: public virtual class ComponentVisibility { protected Id currentUserId = null; protected String currentUserRole = ''; protected ...
0
votes
1answer
26 views

No data populating In VF table. Could anyone please help?

The following code is of an api call. public with sharing class customeQuery{ // Initialization public string companyName{get; set;} public List<consoleWrap> ...
1
vote
2answers
73 views

Trigger How to stop Database.executeBatch cannot be callled from a future method error

I'm calling a trigger after insert and after update, which is calling an Apex Class which hits an endpoint. The triggers are working as expected and firing to an endpoint when a checkbox is selected ...
1
vote
1answer
24 views

Custom Apex trigger is no longer firing on contact or account creation

I have a custom Apex Trigger which calls on an Apex class to send contacts and accounts to hit an endpoint on our Server. This was working correctly until I tried to make edits to the trigger. I have ...
-1
votes
1answer
36 views

Create an Apex class that returns contacts based on incoming parameters

why is this problem appearing ? when both are contact field then both should have name field.
0
votes
2answers
31 views

Show/Hide of a div doesn't work sometimes

I have an aura:component which have two divs inside it. I run a query on my controller apex class and based on the returned value from the query, i want to hide or show any one of the div. Based on ...
0
votes
1answer
65 views

Prevent Duplicates Using Wrapper Class in Apex Class

Note* I am a beginner attempting to jump from level 1 to level 10 coding because there is no easy way to accomplish the task. I need to prevent users from inserting duplicates of a custom object ...
0
votes
0answers
18 views

How to manage Custom Setting data from Community at user level

I have Created one custom setting with email digest feature which sends a mail to user through batch classes as per record value stored For Ex- If Internal user stores as Email Digest Daily then he ...
1
vote
0answers
24 views

Class vs Interface in Patch org

Why am I able to change the access specifier for an interface in a patch org but I can't do the same for a class? I know the documentation mentions some restrictions for patch orgs. I'm assuming the ...
0
votes
1answer
25 views

Test class for updated field value

I have a class that is scheduled using CRON. I have created a test class and the test for the CRON is tested ok. However, the field update is not being tested and I cannot see why. Coverage is 57% ...
0
votes
0answers
13 views

Unable to call the Apex Callout from triggers [duplicate]

I have a apex Class which calls external ERP system and create/updates records there. The apex Class is like below public class createSegment { public class getAzureToken{ public String ...
0
votes
0answers
20 views

Button to generate specific .pdf template based on field

We have a .pdf generator setup on the quote object that generates the .pdf based on a visualforce page template. When you click the "Generate .pdf" button on the quote object it initiates a simple ...
0
votes
1answer
38 views

why @isTest is prefered over testmethod? [duplicate]

I just thinking about the reason behind the @isTest liking, as it is admired by compiler or for some other reasons Salesforce does.
2
votes
3answers
66 views

Form Map Key and Value Pair

I find this use case difficult to construct the expected map structure. Here is my use case - Let's say I have 8 quote line items with Group custom picklist field as below. Group Name Quantity ...
1
vote
2answers
51 views

Incorrect signature even though I'm correctly casting the right objects?

For some reason, my code won't compile and I'm not entirely sure why. The method accepts the following arguments public static void doSomething(Map<Id, Order> oldMap, List<Order> ...
1
vote
2answers
37 views

Child to Parent Query: Updating Parent Fields via Apex

I'm new to apex and still trying to figure things out. I'm attempting to pull the Parent data from the Child to then update. I keep receiving the error "Variable does not exist: Location__r". Please ...
0
votes
1answer
34 views

retrieve parent records and create a child records in a single class

I am a beginner in Programming. Please help me resolve this problem. I have a requirement to create a child record (on Billing Line object) if parent records (on Billing object) exist I need to ...
-3
votes
1answer
34 views

How To Write Test Class for HTTP POST Method [duplicate]

How We can Write Test Class for this Method. public static String authMethod(){ Pardot_Credential_Setting__c objSetting = customSetting(); if(objSetting != null){ ...
0
votes
2answers
26 views

List has more than 1 row for assignment to SObject process builder email apex class

An apex class is triggered by a process builder when a field value is changed. I am trying to send an email to all owners of records of a related object and I get this error. It works when there is ...
0
votes
1answer
20 views

How can I drill down to get field values of nested lists?

I have a custom data type, 'CaseOutput' that returns a list of case records. The below system.debug returns the first CaseOutput element. system.debug(CaseEinsteinHandler.getCaseStatus(listInput)[0])...
0
votes
1answer
22 views

Issue with using a Class inside a Trigger: “Method does not exist or incorrect signature”

I am currently trying to get this trigger to work: trigger ContactRelatedOpportunities on Opportunity (after insert, after update) { List<Opportunity> Opps = [SELECT Id FROM Opportunity ...
0
votes
0answers
12 views

Mass Clone Records on a Schedule

I need to mass clone about 200 records 4x a year. Quick summary of the problem I'm trying to solve. I work for a used textbook company, each school term (quarterly), we go to our school customers and ...
0
votes
0answers
14 views

Help with <Select Option> Test Class [duplicate]

I am attempting to write several parts of code that work together to show Classic formatted list views (with pages to click through) in Lightning and am barely knowledgable in HTML, CSS and sort of ...
0
votes
1answer
27 views

Inner Class Constructor

My Scenario is that I need to call the inner class Constructor from another class, Let me know how can I achieve this. Codes: public class A { // Inner Class public class W { ...
0
votes
2answers
37 views

Inner class : Attempt to de-reference a null object

when i try to add "respDetail" to "response" i get the error "Attempt to de-reference a null object", any idee ? thank you public with sharing class Process_WSI { public class Detail { ...
0
votes
2answers
140 views

How to check for null values for all variables of a custom apex wrapper?

I have a wrapper class written in following manner class Wrapper{ String name {get;set;} Integer age {get;set;} EduWrap edu {get;set;} public String returnTest(){ return '...
0
votes
1answer
28 views

Expanding on APEX Class Method

I have a class method that is assigning a Team to a contact record based on the value from another field. I want to expand this logic so that I don't have to write out multiple methods for each team ...
0
votes
1answer
37 views

Test class passing but not getting any code coverage

so I am newer(ish) to Apex still and clearly know that I am not getting any code coverage to my Apex class because I am not referencing the method, my question is how exactly would I go about calling/...
0
votes
1answer
66 views

How to test picklist controller apex class

I have a lightning component that works just fine but I need to test a controller: public class PickListController { @AuraEnabled public static List<String> ...
0
votes
2answers
31 views

Schedule for Batch

I made a Batch class and Schedule to call that class. However, I am not able to test in Execute Anonymous Window. schedule global class UpdateUserDataSchedule implements Schedulable {      global ...
0
votes
1answer
18 views

How to test a List<SelectOtion> in unittest

How to test a List<SelectOtion> in unittest. I have the following apexclass public class WebToObjAttachments { .. public List<SelectOption> CountryOptions { get { ...
0
votes
1answer
44 views

Need to write an apex class to take in a custom object id and receive a list of related object Ids from that custom object [duplicate]

I am new to salesforce and to coding in general and I am struggling to understand how to correctly write this class / SOQL query. Any advice or guidance would be appreciated. I need to specifically ...
0
votes
2answers
20 views

How to get language from visualforce into into controller extension

I am using a force.com site to show a visualforce page where I want the user to have the option to select a language. In the corresponding visualforce page I set the language. How do I get this into ...
0
votes
1answer
30 views

how to refer a record type in a apex class [duplicate]

I'm writing a Apex class to auto delete Case records of record type claims and service failure with created date older than 6 Years here is the code. But i'm failing to Refer the record type in the ...
0
votes
0answers
36 views

How to access a properties' get accessor of another instance within its class?

I have a simple class with a property and a parent that is of the same type. public class BasicProperty { private BasicProperty parentProp; private Integer myCounter = 0; public Integer ...
0
votes
0answers
45 views

Error is displayed while clicking on file link to open

while clicking on the file link to open the file, it is displaying an error as shown below Unable to Access Page The value of the "file" parameter contains a character that is not allowed or the ...
1
vote
1answer
372 views

Return an Instance of a Class in a LWC (Lightning Web Component)

Below I am Trying to Return an Instance of a Class to a LWC JS to then handle and display to the End User. I am able to successfully call the Apex Class and Method and return data, but the data is ...
0
votes
1answer
25 views

can i call my apex class by just the url

Here is my ( i have tested with workbench and it does work) URL to call : /services/apexrest/ContactUpdatetService.SetContactInactive my json: { "contactId":"1234", } Can I just call it by doing ...
0
votes
1answer
160 views

How this method call works? 'Schema.sObjectType.Contact.isDeletable()'?

I'm struggiling to understand this line of code: Schema.sObjectType.Contact.isDeletable() I've read on the Apex Developer Guide that isDeletable is a method of the DescribeSObjectResult class that ...
0
votes
1answer
52 views

How to add pick list value into test class dynamically

I want to add pick list value in test class i.e when i select pick list value it should be updated/added in the corresponding test class
0
votes
1answer
18 views

How to start bach proces from anonymouse window

I Have the following batch process. How do I test this from an anonymous window? global class Batchtest implements Database.Batchable<SObject>{ .. }
0
votes
2answers
42 views

How to insert or escape single quotes at beginning and end of a null value or replace null with single quotes only

I have this method below that Returns a String of Id's separated by '|' operator and it works. However now I would like to add on that if an Id is null or blank replace with just single quotes (''). ...
0
votes
1answer
57 views

How to make a Json object a subclass

I have a Json Object which I created with the online JSON to apex tool. This works a a separate class how can i make this a subclass. I get the error: Inner types are not allowed to have inner ...
-1
votes
1answer
39 views

Help with LeadConvert Trigger Class? (Creating multiple contacts from one lead)

I've written a few classes for this trigger i'm working on and while I can get 100% coverage for these classes and I can't get more than 0% on the trigger. In the sandbox, this trigger works just ...
0
votes
0answers
23 views

How to separate classes into custom folders

I'm new to salesforce and I am really intrigued by the folder "structure" of the system. Hundreds of classes are stored just in /src/classes/. I tried sfdx with vs code, but just in my new trailhead ...

1
2 3 4 5
19