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

Q: Need to add a list but not sure were in the code

I have a Visualforce page. When you selected a product. I need the "OpportunityLineItem.ListPrice" and "OpportunityLineItem.Terms_c" fields to show the value. The only way I can get the system to show ...
-1
votes
1answer
18 views

Constructor not defined: [Asia1Activation].<Constructor>() at line 27 column 31

I have a class that looks like this: public class Asia1Activation { public Asia1__c thisAsia1 {get; set;} public Boolean isSuccess {get; set;} public Boolean isActivated {get; set;} ...
0
votes
1answer
13 views

Attachment Trigger Test Class

Can you please help me with Test Class regarding Attachment Trigger I have. Whenever I run Test Class I get this error below. System.NullPointerException: Attempt to de-reference a null object ...
1
vote
2answers
20 views

Schedulable Class not fetching Email template in Else Part

Here is the class OpportunityReminderMail which is called from Schedulable class i have added one new if statement to choose another template while Service_segment__c = ESR but it is not picking up ...
0
votes
0answers
21 views

Custom History Tracker trigger and class [closed]

Refering to this trigger (What is the best workaround for the 20 field history tracking cap?), i create an history custom object (OrdinateurHistoryTracker__c) for a custom object (Ordinateur__c). I ...
2
votes
1answer
59 views

Scheduled Apex not consistantly executing, sending emails

I'm having a problem similar to this user's question from about a year ago, although it's not clear to me whether the solution provided there actually resolved the issue (or if it just made the ...
1
vote
1answer
38 views

Apex heap size too large error

Is there any way to make this apex class more efficient? Currently, whenever a case with many case comments is escalated in our system, an error occurs stating the Apex heap size is too large. Any ...
0
votes
1answer
26 views

Apex Class Compiling Error:

Im testing an apex class that I got from Jeff Douglas' page but the I'm getting a "Error Error: Compile Error: line 61:76 no viable alternative at character '%' at line 61 column 76" soql = ...
0
votes
1answer
26 views

Dynamic Way to View Pricebook Entries in their respective Pricebook through Apex?

I have an apex class and vf page that is based on the PricebookEntry object because I want to be able to have a list view of all pricebooks at the top of the vf page and each time a different ...
0
votes
0answers
9 views

API TextVal not always working?

I have an Integration with Brown Paper Tickets to Salesforce (the basic AppExchange unmanaged package), and it seems to be working as expected, unless a person's name in BPT contains special ...
1
vote
3answers
53 views

Update is not working when DML is outside the FOR LOOP

I am having issues when placing the UPDATE outside the For Loop, for some reason is only updating the last selected item in the wrap class, but if I placed it inside the loop it works perfectly. I ...
2
votes
1answer
27 views

How to implement the Sumproduct fuctionality using Apex class

In our project we need to use the Sumproduct Function (Similar to Excel SUMPRODUCT function). How do I implement it using Apex class. Thanks in advance! Cheers!
0
votes
1answer
30 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
65 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
31 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
13 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
36 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
15 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
31 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
19 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
1answer
54 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
19 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
65 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
69 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
37 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
20 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
64 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
36 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, ...
0
votes
0answers
61 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
50 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
49 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
39 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
35 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
88 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
74 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
26 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
51 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
67 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
38 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
136 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
22 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
54 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
54 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
45 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
46 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 ...