Questions tagged [class]

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

163 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
75 views

Enable Apex Classes - Sometimes Only Global, Sometimes Includes Public

I have a managed package that I distribute to clients and I'm running into a curious situation trying to help one install. I have noticed that in the Enable Apex Classes for their System Administrator ...
4
votes
3answers
125 views

Force.com IDE Successful Deployment but No Change in Salesforce

I was able to successfully deploy a change via FORCE.COM + Eclipse. I wanted to delete an APEX class by updating the Status from "Active" to "Deleted". Force.com IDE told me the deployment was ...
4
votes
0answers
457 views

Override PartnerAPI ClassLoader

We have exported as Runnable JAR (Extract required libriries into generated JAR option) our proyect (which has dependecies the fuelsdk and axis). So, there are some classes which read properties ...
4
votes
2answers
93 views

System.NullPointerException: Attempt to de-reference a null object Error

Method : This just one method of the class I am testing from Dev console public Employee__c getEmployeeDetails() { Employee__c emp = null; emp = [SELECT field1__c, field2__c, field3__c FROM ...
3
votes
0answers
171 views

how to create wrapper class so i can show two list data in csv

Header title show proper but its data not showing in proper format because two repeat i have applied, i want work only with one repeat this is my class public with sharing class ...
3
votes
1answer
157 views

Two almost identical test class, one passed one failed

Someone else created a class and test class that works fine: CRequestForm_SearchController and CRequestForm_SearchController_test. I made some edits to the class in sandbox, and copied the test ...
3
votes
0answers
682 views

Send PDF from Salesforce to EchoSign through Apex REST and EchoSign REST API?

How to send PDF generated from VF page to EchoSign through Apex Code and REST API of EchoSign? I'm getting error as "Content Type not Supported/ UNSUPPORTED_MEDIA_TYPE". Any idea? String ...
2
votes
1answer
64 views

Class to only execute on one Record type on object

Aim : I would like this utility class to only execute if the record type for flow is "intermittent". Currently there are two Records types. "intermittent" & "pending " and its executing on both ...
2
votes
0answers
474 views

How to write test class for auto-generated JIT Class SSO

private void handleUser(boolean create, User u, Map<String, String> attributes,String federationIdentifier, boolean isStandard) I am just creating a user in SSO JIT using this handleuser method....
2
votes
0answers
493 views

FIELD_INTEGRITY_EXCEPTION, Chatter Answers User is not allowed for this License Type

FIELD_INTEGRITY_EXCEPTION, Chatter Answers User is not allowed for this License Type On my test class, I am getting the following error. System.DmlException: Insert failed. First exception on row 0; ...
2
votes
0answers
2k views

Response size exceeded 15MB organization limit

I created this class that is requesting large amount of data, I was getting this error:Collection size 1,156 exceeds maximum size of 1,000. And then I found an approach to fix this error, the code is ...
2
votes
0answers
728 views

Apex batch does not update scope

I just created a batch that set some null values in some fields, what I notice is that the batch sets the nulls but it does not update the Object. I need to Edit and Save in order to see the new ...
2
votes
0answers
427 views

Help understanding Web Service Callout Reponse

I just created a web service using wsdl2apex, I am getting the response but I don't know if this response is right, what I mean is if already parsed, if so how can I get the values (VendorId, ...
1
vote
0answers
40 views

Create an Apex class with a method that returns an array (or list) of string hands-on challenge

I am trying to get on with the Create an Apex class with a method that returns an array (or list) of string hands-on challenge but when I try to check the challenge I get the following error: "...
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 ...
1
vote
0answers
45 views

How can I make parent class variables Invocable in flow and process builder?

I have a scenario where I have an InvocableMethod which takes a custom Class with properties which are made available with the @InvocableVariable annotation, but I want this class to extend a parent ...
1
vote
1answer
343 views

System.TypeException: Procedure is only valid for System.DmlException and System.MailException

I am trying to send an object(Account) as a parameter from my batch class, I am getting this exception. FATAL_ERROR System.TypeException: Procedure is only valid for System.DmlException and System....
1
vote
0answers
27 views

Populate a Lookup Field Upon Record Creation

I am trying to create a trigger that will populate a lookup field on a custom object called Levvel Forecat. The basic criteria here is that when a new Levvel Forecast record is created with a ...
1
vote
0answers
24 views

Batch fails to deploy

I have a batch that I uploaded into Production successfully on July 20th and then a change to that batch on July 27th, both with no issues. I needed to make another change to that batch today, so I ...
1
vote
0answers
21 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?
1
vote
1answer
304 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
68 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
1answer
22 views

need to avoid firing trigger on perticular api invocation

I have written one trigger which fires on account create and update,but there is one API which creates/update account and if creation/updation is through that API i don't need to fire trigger. Please ...
1
vote
1answer
114 views

Trying to hide inputField - Visualforce Page

Im trying to hide my Billing_Account__c inputField on my visualforce page, If my custom field Entitas_New__c = 'Pusat' on my custom object Master_Visit_Plan__c. This is the vf page, as you can see ...
1
vote
0answers
509 views

TrailHead EmailManager Apex Test Class

I am using the EmailManager provided in Trailhead and I am writing a test class and it works as expected (and I get over 75% coverage) but I can't seem to get it to 100% coverage because of the ...
1
vote
0answers
40 views

update record based on mutiple queries to related (sort of) objects

My objective: Once an Opportunity is Closed/Won and the quote is the primary, look up the product2 related to the quote line(custom) and find the related subscription plan(custom) and pricebook(...
1
vote
0answers
51 views

Need to add field in apex class email template - not working

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 ...
1
vote
0answers
116 views

direct and redirect iframe from relatedlist to detail and back

I have this visualforce page with 2 iframes in which i want to place a 2 different contact related list and be able to add new contacts on the detail page and be redirected to the related list in the ...
1
vote
1answer
189 views

Getting map value null while running from Test class

I have a map here mapOfQuesToAnsToYearToMaleOrFemaleCount and I am trying to get count here from test class, calling from VF Page I am able to achieve this but not in test class. from test class I am ...
1
vote
1answer
276 views

Wrote a trigger to prevent record deletion, now need help with test class

I'm a newbie when it comes to writing triggers and test classes. I've written a trigger that prevents the deletion of a record on a custom object, System_Integration__c, when a date field (...
1
vote
2answers
104 views

Using common code on on different objects

I have a class which helps to perform a particular operation on a particular object. The code which was designed completely on contact object. I can write new class and use the same code on another ...
1
vote
0answers
74 views

need help with a Two-Part Trigger.new trigger

I could really use some assistance with my trigger/class/test class below. Background: Our SFDC is integrated via WDSL with our SAP installation. SAP is where our Sales Orders (Opportunities and ...
1
vote
2answers
50 views

Map coming back null

I'm trying to populate a custom lookup field on the CampaignMember object. For some reason ocr.OpportunityId seems to come back null based on the debug logs when I run the batch. Can anyone tell why ...
1
vote
0answers
20 views

Querying Master Record in test class vs. in DevConsole

We have a Test class the query a Master record deatils and get nulls only in the test class, in "real" run (via annanumence code run) - it does get values. Any idea? Code: Success__c suc = (...
1
vote
0answers
90 views

Too many SOQL queries error on apex class

I have the class below getting data from a trigger (that seems to be working ok), the problem is, I am getting a "Too many SOQL queries" errors when it executes. If I comment out "insert ...
1
vote
1answer
22 views

Salesforce : Get ActivityDate associated with an object

I am writing a program to fetch the 'ActivityDate' associated with an object on a class. Below is the code that I used. But I am not sure, how to fetch it in a variable. List<Pt__c> partc= [...
1
vote
1answer
72 views

create apex class test that have Data Type formula fields

My code coverage for my trigger is only at 50%. I have 2 (Today_10_Trigger__c,Record_Type_Hidden__c) fields in my trigger criteria that are formulas therefore not writtable. This is my Trigger: ...
1
vote
0answers
108 views

Help creating a test class for automating contact creation

I'm very new to Salesforce, Apex, and programming in general. I'm having trouble creating a test class for my class and trigger. I've looked through similar questions, but they all seem to be far ...
1
vote
1answer
353 views

use trigger to match and populate field based off of another object

So as the title states I am trying to populate a field from the premium object with data from fetchRates. I have code that works but it is not populating for some reason. Any assistance would be much ...
1
vote
0answers
50 views

Test method failure - expecting a DML error but not getting one

I have a test method that is failing because it is expecting an error, but isn't getting one. Here's the test method: static testMethod void assignToSelf_DmlError() { setup(); Test.startTest(...
1
vote
1answer
312 views

Delete apex class in Production with Force.com IDE

Hi I am trying to delete the following APEX class in production and I'm getting the following error. Steps taken: loaded apex class updated status of Meta datga xml file from "Active" to "Deleted" ...
1
vote
0answers
163 views

Turn on User TraceFlag from APEX Class

I am currently having difficulty to add a new traceflag from APEX Trigger or Class. Now, I've tried to use tooling API and using rest API call to activate a traceflag whenever new custom object gets ...
1
vote
0answers
106 views

Methods defined as TestMethod do not support Web service callouts

i'm not using any web services then also error occur in test class. Please help for this : Apex Class : public class RequestPricingController{ public String oppId{get;set;} public Opportunity ...
1
vote
1answer
157 views

Efficient way to get the first data in batch process iteration

This problem is quite related to my first question in this link Get Data from batch iterable I have created a functionality that will upload data to salesforce object using csv. My problem at the ...
1
vote
1answer
619 views

Parsing plain-text body in Email service class

I am trying to parse an Email body for text that follows "name: " within a plain-text email. Should this not do the trick? The field is not being populated Pattern p = Pattern.compile('(?m)(?i)^name:....
1
vote
0answers
773 views

Combine two unrelated objects in table

I have 2 object that are not related, object container contains the items(order + upc + expdate make each container unique). Now I am creating a page that will help to find and pick these items based ...
1
vote
2answers
139 views

How can i improve test coverage?

I am new for test class but I have covered 54%.My class having web service i don't know how to write test class to web service. Please can any one help me out.I need to move production.. Apex class: ...
1
vote
1answer
912 views

dynamic datatable

I want to create a datatable with opportunity information. I add a picture that shows how the table should look like. I have the information for the table ( below is my class code), but I don't know ...
1
vote
1answer
630 views

LAST_N_DAYS doesn't work correctly

I have selected all accounts with a few information and the lastmodifieddate of the opportunities. I ordered the join by the lastmodifieddate DESC LIMIT 1. This is fine so far, when I output the date ...
1
vote
0answers
63 views

Not executing part of class as user

I have been battling this for a while and I assume this might be a permission issue. I do have a trigger that updates sample requests for a product with manager that needs it to be assigned. The ...