Stack Exchange Network

Stack Exchange network consists of 175 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
37 views

with sharing without sharing vs extension?

While going through manuals, it was mentioned Many times that apex classes will not consider security of logged in user but it will run in system mode and we should add custom controller extension to ...
-4
votes
1answer
50 views

Test class for below class [closed]

public class ExampleClass { public static void publishCaseUpdateNotifications(List<Case> cases) { List<Case_Updated__e> notifications = new List<Case_Updated__e>(); for ...
0
votes
0answers
31 views

How to disable the trigger in production with the custom label

I have one trigger onAccount which is not allowing me to insert update new Accounts to other objects so I would like to know how could I disable the trigger/class in the production without moving in ...
1
vote
1answer
29 views

How to add a generic method for Encryption and decryption when using multiple times in the code?

I am trying to encrypt two fields when record is submitted using VF page. As there are multiple functions in my class I am encrypting and decrypting multiple times as needed. Is there a way we can ...
-1
votes
2answers
65 views

count of number of occurrences of the words in the sentence passed to the method [closed]

How do I code a method which expects a string and prints the count of number of occurrences of the words in the sentence passed to the method. Sample Input/Output : Input : My Name is good and I ...
0
votes
1answer
38 views

How to rank Users depends on a custom field in apex? [closed]

Question in detail : I have 20 Users {U1, U2, U3....} and 5 Regions {R1, R2, R3, R4, R5} and Ammount__C custom field on User. Now those users are distributed among those regions. So i want to give ...
2
votes
2answers
43 views

FIELD_INTEGRITY_EXCEPTION, High Volume Portal Users cannot have a user role - Test class

The user role created below is not 'High volume Portal User' but, still production deployment validation fails with error "FIELD_INTEGRITY_EXCEPTION, High Volume Portal Users cannot have a user role". ...
1
vote
0answers
14 views

Need help for create the test class [duplicate]

I'm a new developer and it's my first test class. I need your help to do it the class test for my helper class. HELP ME PLEASE!! @isTest public class TestOrderWizardHelper { static ...
0
votes
0answers
39 views

Call a field inside a class dynamically

I have a JSON that I get as a webservice and deserialize it into classes. The classes are : public class DataStructure{ public String Name; public String Code; public String ...
0
votes
1answer
75 views

We want to get a list of lead and opp. that have the same date (custom fields) in the record as the actual shown lead

What we did so far... We created a visual force page that calls a class and added an extension to get the ID. We got some Error :) (We try to get the ID for the currently displayed Lead, which ...
4
votes
3answers
162 views

How to assert on pagereference where the endpoint of pagereference is predefined [duplicate]

I have a pagereference for which I want to write a test class but get the error Expected: System.PageReference[/CustomLoginPage], Actual: System.PageReference[/CustomLoginPage]. What am I doing wrong:...
0
votes
1answer
24 views

Using without sharing methods inside with sharing class (with sharing applied)

I have a controller ControllerClassA which is with sharing. And i also have another class HelperClassB which is without sharing. I have a method inside a without sharing class HelperClassB which is ...
0
votes
0answers
49 views

Open Add Product page in lightning

I want to display the add product to opportunity price book page(/p/opp/SelectSearch) in lightning. We override the opportunity edit screen with VF and then redirect to this page: ...
1
vote
1answer
37 views

Command Button not saving!

The command button on my Visualforce page is not saving edits to the record. Any help is appreciated! Visualforce Pg: <apex:page action="{!redirectToPartnerships}" extensions="EditExtensions" ...
0
votes
0answers
18 views

Help writing a test class for apex class I want to deploy to prod [duplicate]

Public Class controller_SoqlQuery { public List<AggregateResult> medOppsCount{get;set;} public List<AggregateResult> nonMedOppsCount{get;set;} public List<AggregateResult&...
0
votes
0answers
26 views

How to write Apex test for record creation? [duplicate]

I'm having a hard time writing up a test class for the following Apex class: public class logger { @AuraEnabled public static void insertLog(string name, string id, string location, string ...
0
votes
1answer
33 views

Access Object in Apex Class / Method after passing it from Controller

I (seemed to) have sucessfully passed an object from the client side helper controller into the apex method. However i am having trouble accessing using the dot notation i am used to in javascript and ...
0
votes
0answers
22 views

write a test class for a StandardController [duplicate]

My Controller: public class GeneratePDF { ApexPages.StandardController stdController; public Contact cnt {get;set;} public GeneratePDF(ApexPages.StandardController controller){ ...
0
votes
1answer
41 views

isAfter && isUpdate is not triggering [closed]

So I have created a trigger and a trigger handler class, but I cant seem to make either of them trigger in an isAfter && isUpdate call. My updateInstallStatusDesign works fine when it is an ...
0
votes
1answer
23 views

Saving multiple classes with inter dependencies

I have made some changes in an Org1 and trying to move those changes to Org2. Some classes are changed and some newly added. The classes are compilable in Org1. These classes have interdependency. ...
0
votes
0answers
87 views

System.SObjectException: Invalid field Category for Case

Class.BatchCarrierUpdate.execute: line 59, column 1 Boolean toUpdate = false; for(String strFieldName : caseToCarrierUpdatedFieldMap.keySet()){ System.debug('**...
0
votes
1answer
27 views

Test Class with wrapper [duplicate]

I have a problema with a Class test in the wrapper class.. This is mi class and doesn't have any error: public class ValeDeSalida_cls { private ApexPages.StandardController sc; public String ...
1
vote
0answers
18 views

Why does the systemmodstamp for my apex classes update

Does anybody know why all the SystemModStamps on my Apex Classes are updating with no other changes to the Classes?
0
votes
2answers
38 views

Invalid conversion from runtime type

I basically have the same problem that was described here Invalid conversion from runtime type MyClass.A to MyClass.B but i'm unclear as to what the solution is I have a virtual class A and classes B ...
1
vote
1answer
80 views

Invalid type for implements System.Schedulable Class [closed]

I have the following class which I try to schedule from the anonymous window but this gives the error: invalid type:abc_RiskSchedulerProcessor Class global class abc_RiskSchedulerProcessor ...
0
votes
0answers
15 views

User Trigger to Assign Lead Lookup not firing [duplicate]

I'm a bit stumped as to why this isn't firing. It's supposed to work when a User Lookup field called ISR_Owner__c on a User record is updated it will try to find all Leads owner by that User. It will ...
0
votes
1answer
169 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
24 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
32 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
53 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
20 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
42 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
84 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
46 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 ...
1
vote
2answers
82 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
46 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
430 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
54 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
54 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
33 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
81 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
30 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
33 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
36 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
43 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
138 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
189 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 ...