Stack Exchange Network

Stack Exchange network consists of 174 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

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

0
votes
1answer
8 views

Learn Parsing JSON

Im trying to get values from API request.. there`s 2 user data from the response and I want to get the data of each user and put it on the list.. but my code only store the last user data from the ...
0
votes
1answer
19 views

Need Help with a custom Setting

i have a custom setting with a field type "checkbox" set to true but if i try to query it on a class it's allways returning false, i don't know why. Email_Engine__c ee = Email_Engine__c.getInstance();...
-1
votes
1answer
31 views

My test class keep failing. Moving the rev scheduler with the close date

Im not getting any coverage with this test class. YOu'll see the trigger and the class handler are here. ============================================================== @isTest private class ...
1
vote
1answer
18 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 ...
0
votes
1answer
10 views

Maximum stack depth reached: 1001 inner class

I'm trying to export record on into a tab separated text file. In getting Maximum stack depth reached: 1001 in the inner class where i'm doing the piece of code and I have pasted full code in the ...
0
votes
1answer
33 views

'Last Viewed By' Account field test - System.QueryException: unexpected token: 'null'

Trying to create a Last Viewed By field on Account. I'm newbish at Apex and not seeing what I'm missing here... I'm sure it's a rookie mistake. Adapting code from http://www.sfdcpanther.com/setting-up-...
1
vote
1answer
39 views

Apex Inputtext not getting assigned to variable in apex controller

I have below pageblocksectionitem in VF Page. <apex:pageBlockSection showHeader="false" columns="2" id="blockseciframe" > <apex:pageBlockSectionItem > <apex:...
0
votes
1answer
30 views

OrderTrigger: execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object

I got stuck at one place on one of my requirement on which I am working on. My use case is as follows: SCENARIO 1: Close Opportunity when Upgrade Order is cancelled GIVEN a a person account record ...
0
votes
0answers
19 views

How to track stage of the opportunity record is not Closed-Lost (unless the stage was automatically set to Closed-Lost within the past 90 days

I am working on one requirement and I got stuck at one place. I hope someone will help me to resolve my problem and guide me in proper directions. My use case is as follows: SCENARIO 1: Close ...
0
votes
1answer
13 views

Why does my country returns null on creating an account?

I am creating a testdatafactory. creating a country goes well. When creating accounts my country fields are null if i debug CountryList it returns the created country record. Factory class @isTest ...
0
votes
2answers
34 views

How to build a testdatafactory without error : DUPLICATE_VALUE, duplicate value found: duplicates value on record with id: : []

I an trying to create a testdatafactory which i can use to call in my tesclasses. What I want to achieve is small buildingblocks with which I call another method if a lookupfield needs to be filled. I ...
1
vote
3answers
50 views

How do I stop this trigger from running more than once?

I'm still fairly new to Apex. Currently in our org we have a class called CommitmentProcess and a trigger called CommitmentTrigger. We use this to clone Opportunities that are up for renewal. So for ...
2
votes
2answers
35 views

Code coverage annotation for or statement next line or same line?

Ik have a class with several or statements. To make the code more readable I placed the or statements on a next line. My dev console shows that there is no coverage for these lines. Do I need to place ...
0
votes
1answer
27 views

Does an Apex Class run linearly (procedurally?)?

I am used to writing a run method in Java which specifies where the code runs. Outside of this nothing runs unless called. In apex there I don't see a run method. I'm guessing it starts at the top ...
0
votes
0answers
21 views

Zuoracoverage issue

How to cover this method as zuora callout is happening public boolean UpdateToZuora(string objName, map<string,string> MapZuoraValue , Zuora.zApi zApiInstance) { List<Zuora.zObject> ...
0
votes
1answer
31 views

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY - INVALID_CROSS_REFERENCE_KEY

I'm also getting a the following error from my apex test and trigger while validating. The error,test class and trigger are below. Run Failures: TestAfterPOLogUpdateTest.myUnitTest System....
1
vote
1answer
30 views

How to put a list in the parameter for class and use its variables?

I have a JSON and I need to pass the data to a list, then use it as my class parameter. I've managed to pass JSON to a List, but when I put it in the class, it throws the following error: "global ...
3
votes
1answer
24 views

Can a managed package query and list all the classes installed in a subscriber organization?

By querying the ApexClass object, one can list all the classes that exist within an organization. However, if the code which queries the classes is from a managed packaged, can it see all the records, ...
0
votes
0answers
26 views

pdf file is not showing in formula field as a image in My custom object file_name__c (field name(Content__c)) is this is possible or not?

public static void Savefile(id fileId,id familyHealthId){ PageReference pdfPage = new PageReference('/apex/FamilyHealthCardPdf'); pdfPage.getParameters().put('id',familyHealthId ); ...
0
votes
1answer
25 views

How would i write my map/soql query outside of the for loop?

public static void oppFldUpdates(List<Opportunity> newOpps, Map<Id,Opportunity> oldMapps){ Opportunity oldOpp = new Opportunity(); for (Opportunity newOpp :newOpps){ ...
0
votes
2answers
52 views

Populating field value of Case using Apex Class?

I'm trying to populate a lookup field through apex, though am currently testing by populating a simple text field after a form is submitted, activated through the process builder. Below is my code, ...
0
votes
0answers
80 views

Passing apex class as a parameter from lightning component to apex class

I want to pass apex class as a parameter from lightning component to apex class method.When I tried, I am getting error as "Error message: An internal server error has occurred Error ID: 124770038-...
0
votes
2answers
128 views

Basic Map And I am Stuck in FOR Loop [duplicate]

Here is my Map Map<id,List<Custom_Report_2__c>> mapreports= new Map<id,List<Custom_Report_2__c> >(); for( Custom_Report_2__c cr:cr1){ mapreports.put(cr....
1
vote
1answer
37 views

JSON content display : Attempt to de-reference a null object

I am trying to display content from a JSON feed on my Salesforce page using APEX/visualforce page. From information gathered, I am able to get the details of the JSON on variable. But when running the ...
1
vote
1answer
20 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 ...
2
votes
4answers
258 views

System.LimitException: Too many DML statements

I want to mass update my account record. But I got this error when trying to deploy the code. public class Insert_CustID_Old { public void insertCustId() { List<Account> accList = [...
0
votes
0answers
15 views

How to create a new record if it does not exist, update quantitiy if it does in an apex class

I have this class that creates a custom object record when an opportunity is marked as "contracted" (Using CPQ). It looks at the OpportunityLineItems - compares what is there to another object that ...
1
vote
1answer
56 views

Scheduling Class to insert new Records

I have written a Schedule Class to insert records when a certain record's date is four days ago. It should insert a new record but of a different record type. So for Example, if a package record type ...
1
vote
1answer
30 views

How Exactly Do the Class and Trigger Connect in this Design Pattern?

Early on as an Apex developer, I adopted the following one-trigger-per-object design pattern: Class public with sharing class caseTriggerHandler { public static boolean firstRun = true; ...
0
votes
0answers
26 views

Cross object value

I need some help with getting some object values.. I have a custome object called Named_user__c and a field on that object called Branch__c.. this object contains name, etc just like user object.. On ...
2
votes
1answer
20 views

Help getting processInstance value

I want to insert this Approval History section on opportunity to my PDF (There`s a pdf button on my opportunity object).. But what appeared on my pdf [ Issue : How to get every status date? You ...
0
votes
2answers
47 views

Email reminder scheduler

I want to make a mail reminder that automatically send the email to my sales user every h+7 h+10 and h+15 created date.. how do I code the scheduler? using IF? for example, I want this mail reminder ...
0
votes
3answers
73 views

Test Class - DUPLICATE VALUE?

Im new in salesforce programming.. I have a trigger called CR_Approved and test class called CR_Approved_Test.. The trigger purpose = if Change_Request_Item__c.Status__c = Approved and recordType = ...
0
votes
2answers
33 views

ASK - Field value is blank in Apex single email (HTML Template)

My case is i want to send email with attachment in custom object using single email message using HTML Email Template (with letterhead). Current condition i successed to make the email same like ...
1
vote
1answer
164 views

error: DUPLICATE_VALUE, This price definition already exists in this price book: []

Here is the error message & my test class: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, This price definition already exists in this price book: []...
1
vote
1answer
63 views

Roll Up Field of Open & Closed Activities on Account - Using an APEX class

The use case is that I am trying to have a roll-up field on the account object that is a sum of the total # of Open and Closed activities on the account. This would be easy with a Trigger, but I want ...
0
votes
3answers
64 views

Skip and dont add null value to list?

Im trying to make a mail reminder on case object to every owner/case.. but everytime I execute the code, there`s an error System.EmailException: SendEmail failed. First exception on row 4; first ...
0
votes
1answer
32 views

How to get opportunity history value and convert it to pdf?

im new in salesforce programming.. I made an pdf report (button) on opportunity.. I can get the opportunity object field value (and opportunityLineItem) and convert it to pdf.. but down below the ...
1
vote
1answer
40 views

Apex class getSimpleName() equivalent

I would like to get Apex class name without namespace prefix. I wonder if exists any equivalent method like known in Java getSimpleName() ? Existing method getName() returns apex class name with ...
0
votes
1answer
56 views

Help Apex Class - Email Reminder

I want to make an email reminder if case status != closed to case owner every H+5, H+7, and H+10 .. H = created date and I want to make a table (as email body), so the email body = list of cases ...
1
vote
1answer
254 views

how to get value from map when wrapper class is the key

I have a wrapper class of picklist values and labels. I am creating a map with picklistValues and List as key and value types. Now, I am getting an error won this line -- objResults.get(...
2
votes
1answer
99 views

get set from controller extension to visualforce page

I have a controller with extesion from which I try to pass the subtitle values to my visualforce page but I cant seem ro render it. My system.debug('subtitle 1 '+ subtitle ); gives : subtitle 1 {...
1
vote
3answers
75 views

Help Schedule email reminder

Im new in salesforce apex programming.. I want to make an email reminder if case status != closed to case owner H+5, H+7, and H+10 .. H = created date .. how do i get the owner email value? and ...
0
votes
1answer
114 views

Not able to query attachment coming from email to case

Why is the attachment blank even though i have attached one while creating case from email. List<Case> cases = [SELECT Id,OwnerId, (SELECT id,Name,ContentType FROM ...
0
votes
0answers
51 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 ...
-3
votes
1answer
75 views

How to increase code coverage of a test class?

Apex class :- global class BlockIEPolicyCondition implements TxnSecurity.PolicyCondition { public boolean evaluate(TxnSecurity.Event e) { List<User> users = [SELECT ProfileId FROM ...
0
votes
1answer
53 views

How to show user a message and stop APEX Class execution

I have a APEX Class that runs from a button on a standard record page. It creates a related record in another table. The code works fine as it is now. But I want to add a feature that does a ...
1
vote
1answer
41 views

Wrapper class Referencing?

How do I reference my wrapper class in my prepareshipment method? My goal was to set tNumber and location to = my fields on my shipment object. In my VF page I want tNumber and Location to display ...
8
votes
1answer
544 views

How to deserialize JSON to a class where the same variable name has different data types?

I am trying to deserialize some JSON to a class using JSON.deserialize. My JSON looks like this { "type": "GeometryCollection", "geometries": [ { "type": "Point", ...
-2
votes
1answer
65 views

How to evalute Rule criteria of workflow with Apex Programming? [closed]

I want to evaluate Rule Criteria Expression with Apex Programming. For Example :- Rule Criteria :- (Account: Account Name EQUALS ads) AND (Account: Account Number EQUALS 1234) I want to evaluate ...