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

1
vote
1answer
13 views

How do I simulate a checkbox click on a Visualforce page from a Controller class?

I have a Visualforce page with a header section that has a checkbox, and a detail section with a table that has a checkbox in the first column. Based on the data loaded the checkboxes in the table are ...
4
votes
3answers
62 views

Error in using multiple @future methods

I have created a Trigger and Class that works in dev environment, but I'm trying to deploy it to production, and it is testing all of my code with all the other classes in the environment. The only ...
0
votes
0answers
25 views

need to invoke class method through trigger for multiple products [on hold]

I have a trigger on opportunitylineitem where on adding products it will create a new record in other sobject for each product. when i am adding multiple products at a time it is invoking class but ...
0
votes
1answer
45 views

Help Writing a Simple Test Class

How in the WORLD do I write a test class around this code? I've been able to get a successful test run, but the test says I have no code coverage. All this code does is take 5 text inputs passed in ...
1
vote
0answers
17 views

Serializing/Saving the values of a custom class?

Would it be possible to create a custom class whose values can be saved, and then possibly even reported on, without creating a custom object behind it? The reason I ask for this is because this ...
2
votes
2answers
35 views

purpose of utility class

In my organisation , they ve written a class and in description it says " This is Utility Class " . Actually what is the purpose of utility class ? Why are we using that ?
0
votes
1answer
17 views

Help with test classes for VisualforcePage Redirect controller

I'm very new with apex, and having a lot of trouble getting code coverage for my tests. Here's my Visualforce page: <apex:page standardController="Task" > <apex:enhancedlist type="Activity" ...
3
votes
1answer
99 views

For a new class should i upload meta.xml to github?

I know this is a dumb question but I never faced this situation. When I write a new class and need to push the class to svn/git do I need to upload the -meta.xml file also? or just the .cls file?
1
vote
1answer
40 views

Apex class for trigger

I am writing a test class for Contact record update trigger I tried my best but it's not working, please check and give suggestion to improve my code @isTest public class TestStopEmails { static ...
5
votes
2answers
402 views

How to prevent users from viewing apex code?

There are many apex classes and triggers in my production org. Despite 'System Administrator' being the only enabled profile, (in Develop>>Apex Classes>>"Class Name">>Security) users can still view ...
0
votes
1answer
21 views

Mass transfer approval process

In our case, usually the users request us the approvals pending of a particular user. We go to Setup -> Administration Setup -> Data Management -> Mass Transfer Approval Processes and we manage ...
0
votes
1answer
42 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
22 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
33 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
25 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 ...
2
votes
1answer
82 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
55 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
36 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
44 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
58 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
33 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
31 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
79 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
34 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
16 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
40 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
18 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
35 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
68 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
24 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
77 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
85 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() == ...
1
vote
1answer
57 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
25 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
77 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
41 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
95 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
53 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
56 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
47 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
38 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
110 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
110 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
71 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(){ ...