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

learn more… | top users | synonyms

0
votes
1answer
28 views

Integer declaration

I have below method in a public with sharing class. In the method, I need to use an integer but unable to declare that. Can someone please help me in integer declaration here? Snippet: public with ...
0
votes
0answers
10 views

Is there anyway I can know which all methods are there in the class thru Apex Code? [duplicate]

I want to know if I can get a list of methods that a class contains, and how those methods are invoked. Can anyone help? Thanks in Advance.
1
vote
1answer
62 views

Check if a string substring value is alphabet

I have a requirement to make string values passed as init caps. How to check whether the element I am capitalizing by toUppercase() is an alphabet or not? Please find my code snippet here. Snippet: ...
0
votes
0answers
20 views

Difference between capitalize and to Uppercase()

I have a requirement to make a string value passed as initial caps. Can someone let me know what can be demerits using .capitalize method instead of substring the first position and convert it to ...
0
votes
0answers
12 views

Wrapper classes are not getting covered though object gets created and functionality runs.

I have few classes which I have created for Json request format. When I run the func in test classes, everything covers but wrapper classes. for example let's say I have to send {"stack ...
2
votes
1answer
35 views

Can't produce results percentage out of my class

I have this class, but the results for perLost and PerWon is always 0, I can't figure out what I am doing wrong. public List<Opportunity> Stages {get; private set;} public Integer ...
0
votes
1answer
14 views

Split functionality for consecutive occurence

I have below code snippet for making immediate letter after space in capital. But this fails for consecutive two spaces and throws error. Can some one guide me here? List<String> ...
0
votes
0answers
12 views

Is there a way to define and execute a class in the developer console?

I want to do some analysis of records for an object. The problem is that there are some values on some records, maybe say 57 out of over 1.7 million, that I need to see what kind of data is being ...
0
votes
1answer
29 views

Apex Trigger/Class add Contact field value to Task

Whenever a task is created on a contact, I would like to populate that task with the value of a number field from that contact. Is a Trigger/Class the best way to do this, or are there simpler ...
0
votes
2answers
18 views

regd Test class

I'm writing a test class on Opportunity which is testing trigger which execute on update. I've simple questions- I'm trying to print user which has created opportunity in this test class. I'm using ...
2
votes
0answers
36 views

DML 10001 Apex Class Error

I have a class that is failing. Sometimes the trigger associated to it is mentioned in the error message. The error messages I receive are listed below. These classes used to run just fine. I'm not ...
0
votes
1answer
18 views

Static boolean is not initialized when the code is called from a test method

public UtilClass { public static Boolean someBool = true; public static List<SomeObject> someMethod() { . . if(someBool) { // do something } ...
1
vote
1answer
59 views

How Do I Write A Test Class For A Trigger Using The Below SOQL Query?

Dear fellow SalesForce StackExchange, I got the following SOQL query working in Workbench. (Note: If any IDs look invalid, it's because I did some typing-over them to anonymize my code, and I may ...
-1
votes
2answers
59 views

Error on test class

My trigger is : trigger TaskTrigger on Task (after insert) { List<Order> ordersToUpdate = new List<Order>(); for(Task t : Trigger.new) { if(t.WhatId.getSObjectType() == ...
0
votes
1answer
26 views

Test Class error while having an OrderItem into it

Hi I am trying to have an orderitem into my test class in order to test a trigger. class is : ` public static testmethod void TaskTrigger_Test1() { Account a = new Account(`enter ...
0
votes
1answer
17 views

Test Class Problem

I am having a hard time to run my test class for my trigger WHERE my trigger updates the Contacts Mailing to Accounts Biliing Address whenever the Accounts Billing Address is updated. This is my ...
1
vote
2answers
57 views

test class for a trigger

I have 2 triggers into sandbox that work s perfectly and I want to transfer it into production. The only problem is that I need to write a test class for each one in order to cover 75% of the triggers ...
0
votes
1answer
30 views

Showing an exception when saving apex class or trigger from laptop

I am trying to implement an apex class in my developer organization on my laptop but I'm not able to save the class. It gives me this message: Error: Compile Error: unexpected token: 'undefined' at ...
0
votes
0answers
30 views

How can i check null values in list [duplicate]

public PageReference saveObjective() { System.debug('checkValue'+checkValue); String parentName=QueryBuilderUtility.getRelatedObjName(objConfigurationQuery.sObject_4__c, ...
-1
votes
0answers
31 views

on save method check null at any of the field

Hi i want that if any of the fieldvalues gets null then i will display message. public PageReference saveObjective() { System.debug('checkValue'+checkValue); String parentName = ...
0
votes
0answers
44 views

Test Class - How to create a Partner Account

My need would be to create a Partner Account (that is: an Account with field isPartner set to true!) in test class, having checkbox PartnerAccount set to true, but I'm not having success with this ...
2
votes
1answer
48 views

Including more crtieria to if statement on Apex class

I need some help I have an apex class which needs amending so it works on more than one criteria. Currently the class works if “Type” Contains the word “Meeting”. But I also need it to include the ...
1
vote
2answers
43 views

Helper Class Error - Grouping in Aggregate

I don't get an error in the console, but for the below helper class but when I edit my record I get this error on save: "Error:Apex trigger RoomTypeTrigger caused an unexpected exception, contact ...
0
votes
1answer
38 views

Stop Apex Class From Failing

I have a class that is failing OnAfterInsertUpdate. I'm getting the following errors: First error: Apex CPU time limit exceeded and "First error: Update failed. First exception on row 1200 with id ...
0
votes
0answers
34 views

Need help with Apex Test Class

I have an Apex Trigger that fires after insert of a Task, so I'm trying to write a simple Test Class to create a Task to get my code coverage. My code is listed below: @isTest public class ...
0
votes
1answer
74 views

Get selected Parent row and Child select records from nested pageblockTable

I have a nested table, the third column displays the Child records related to the Parent Account. I am using a wrapper class to get the selected row but now i need to get the selected records from the ...
0
votes
0answers
61 views

Exclude weekend and holidays in salesforce formula field

I have a requirement to show the 1st Followup due date (which is 3 business days from the service Due date), 2nd Followup date (Which is 6 business days from the Service Due date) and 3rd Followup due ...
1
vote
1answer
25 views

Trying to Transform this Trigger to HelperClass

I wrote the trigger and it works great but now I need to transform it into a helperclass so I can reference it on our master trigger for the Case object! This is my first trigger to ever write and I ...
0
votes
2answers
45 views

Accessing PageReference method from different class

I'm a newbie to salesforce. I have 2 Apex class as follows: public class A { B bb; public PageReference save() { bb = new B(); return bb.pay(); } } public class B { public PageReference pay(){ ...
1
vote
2answers
57 views

confused regarding static variables

Till now my idea was static and new keyword are independent but when using testclasses I've found new concepts which are confusing See below class , We've to declare list as static to use it in ...
0
votes
1answer
36 views

Intialize inner class variable from a different class

I am bit confused on accessing the inner class variable from a different. I have created a class structure to serialize and create a json request. I need to send an custom object with attachment. ...
0
votes
1answer
8 views

Translate Spanish characters to english [duplicate]

I have a custom object Address. Here in Line 1 (text) there Spanish characters are enterred. How to achieve a translator by a custom setting or any other way for data in salesforce? Can someone please ...
1
vote
2answers
114 views

Collection is read-only - Apex Class Error

I am trying to move my trigger into a class, and then call the class from the trigger. However, I'm getting an error when I try to do an insert, update or delete on my VOActivity object. The error ...
0
votes
1answer
20 views

Translate spanish characters to english for field values

I have a requirement to translate few predetermined spanish characters to english in field values of different custom objects. I have tried to create a generic code. can someone please let me know ...
0
votes
2answers
47 views

Null Pointer exception

I have below generic class, whose methods are called from an Account before insert , before update trigger. Below class is getting a Null Pointer exception for any Account at commented line. Can ...
0
votes
0answers
23 views

Generic class to do trigger operations

I have a requirement to create a generic class having a method to do all operations as in my below trigger. Now this trigger will invoke the method of generic class to do the operations passing ...
0
votes
0answers
45 views

Help with Inserting an Opportunity in a TEST Class for Code Coverage

I'm having issues with an APEX test class to provide code coverage to a Trigger I created. Here is the code of the Trigger. trigger UpdateOpportunity on Opportunity (before insert, before update){ ...
1
vote
2answers
43 views

Class to auto-create a record once a day on a schedule

Is it possible to create a class that will automatically add a record every morning at 9:00am? The record will have the same data in the fields it just need to automatically insert every morning. ...
0
votes
3answers
42 views

Picklist Values Synchronizing across objects

Good afternoon I am hoping someone can help. I have spent the last couple of hour’s researching the different possibilities and I am none the wiser Aim – If a value is added to the following field ...
4
votes
3answers
221 views

Apex Test Execution Stuck in Queue

I have attempting to run an Apex Test Execution and my test has been stuck in "Queue" since yesterday. It doesn't look as though I , as the Admin, have been locked but still no progress on the queue. ...
1
vote
1answer
32 views

How to select one field from one table in apex class?

I have an apex class with some code like this: public List<Product2> myList{ get{ myList = [Select p.url__c, p.ProductCode, p.Nom_du_produit_2__c, p.Description From Product2 p ...
0
votes
1answer
36 views

Apex Class that checks a checkbox when contact is generated (match.random)

I have partly created an apex trigger that randomly selects a contact that is in a specific campaign. This works and I can cycle through the contacts at random. When i refresh the page however I am ...
0
votes
0answers
34 views

split method occuring once

I have below class snippet where split method is parsing data only once. It should be doing for all data. csvfilelines.size() shows 5 but records displayed from the sObjectList is only show one. ...
0
votes
0answers
15 views

Apex Test Class for a Lead Trigger [duplicate]

Hi I am new to the salesforce development. I have made a trigger by looking at some videos but not sure about how to make a test class for it.I am pasting it over here. how shall i start. I havenot ...
0
votes
0answers
26 views

Store record values before update

I have a requirement to allow User Rollback the Updates here by one click on a commandbutton. That feature I have tried to tackle by Revert Changes button here . Is there any other way to deal with ...
0
votes
1answer
109 views

Display error message from controller fails

I have below apex page where I am trying to catch a custom apexpages.addmessage from the controller. But it is not working , simply not displaying the error message in page. Can someone please help? ...
0
votes
0answers
18 views

Write a batch class which will delete the saved files from that folder

Can any one help me out this ? Write a batch class which will delete the saved files from that folder and e. Batch will run every week.
0
votes
1answer
123 views

Access user creating a record in before insert trigger

I'm trying to set some default values for contact fields based on which user is inserting the record into the database, but am coming up against a NullPointerException as the CreatedById is null ...
0
votes
1answer
33 views

Attempting to deploy SF samples to sandbox, blocked by low test coverage

I'm trying to deploy a class to production, and after doing some reading I set up the proper ant things and decided to deploy the sample classes to the sandbox first. I get the following errors: Code ...
1
vote
2answers
401 views

Compile Error: Constructor not defined: [MyController].<Constructor>(ApexPages.StandardController)

Can I get some help with my test class for my visualforce page? The page lists contacts and then the controller creates an activity for each contact selected after a button is clicked. I am ...