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

Questions tagged [apex]

Questions relating to Apex, the native programming language for the Force.com platform. Use it for general questions on syntax, errors, constructs, and rules of use. Most questions should include a code *excerpt* to help answerers understand specifically what has gone wrong or why you need help.

-1
votes
0answers
10 views

How to call one method after another in wrapper class?

I Have a lookup based on that value selected i have to query and get the select options. I am trying to call the wrapper class but its throwing me null pointer error.guide me where i am going wrong. ...
-1
votes
0answers
6 views

How to invoke controller setter method in trigger beforeInsert()?

That is my VF page: <apex:page standardController="Lead" extensions="LeadDuplicateController" tabStyle="Lead"> <apex:pageBlock > <apex:pageBlockSection title="Lead ...
0
votes
2answers
15 views

How to upsert multiple sObjects in a single DML where some have external ids as a matching field?

I have a rest @RestResource class that has a post method which needs to upsert an Invoice on an external Id, and update the associated Acct. In my existing code, I have 2 dml stateents below. Is there ...
0
votes
0answers
8 views

Visualforce: How to make outputlabel display above an inputfield?

I have this as my visualforce page code: <apex:pageblockSection id="thepbs" columns="4"> <apex:pageBlockSectionItem > <apex:outputLabel value="{!$ObjectType....
-1
votes
1answer
11 views

Best website's to practice & master APEX, VF, LIGHTNING coding? [duplicate]

Can someone tell me which are best sites to practice & master coding in APEX, VF & LIGHTNING. I am relatively new to Salesforce. I actually want some sample basic & medium level projects ...
0
votes
1answer
23 views

How to rerender specific row independently for picklist values

I want to render picklist values based on each row when lookup is selected. There is a filter where it checks the recordtype of the lookup and based on it picklist value will be displayed. The problem ...
-1
votes
0answers
15 views

Chunck Account list into List<List<Account>>() based on a condition

I am having trouble with a small piece of code. I am calling an API, with List of accounts address. API is working fine, but it gives error when URL endpoint length exceeds 3500. I have a look on ...
0
votes
0answers
8 views

Save Email Conversion

I'm trying to use the Lightning Experience UI to send an Email from a Record Homepage via the Activity tab. That way the email that sends from this UI is saving (in a not surprisingly way) in the ...
0
votes
2answers
15 views

Inner Class Cover in Test Class

Please help me why my code coverage is showing 0% . See my class code and test class code where I have written wrong? Class public class InnerClass { public class Wrap { public string ...
0
votes
1answer
22 views

Trigger to add contact in Account Related list when contact is added through lookup on Account

I have one lookup field (Add contact) on Account. My requirement is that when we update the account lookup field and select a contact. Then that contact should get attached in the related Contact List ...
0
votes
2answers
24 views

Locking rows at the last minute

I have a utility routine (pasted below) that I use for all writes to the database which lets me catch errors. This works perfectly in all but one of my orgs. In that org, I generate a ton of ...
0
votes
0answers
10 views

Apex Multipart HttpRequest - With JSON and BLOB

I am trying to consume a Google Drive API to create a file in an ApexController. I was successful in creating a file in the root folder without specifying a name using the code below http h = new ...
0
votes
0answers
17 views

lightning component to sort task based on status then second priority is created date

I am trying to sort the lightning component of task based on status then by created date. When I click on sort by Status, it should update the second sort of created date by ascending. So in the below ...
0
votes
1answer
13 views

Combine two List<Map<String, String>> for unique list

How can I combine two lists of maps so that only the unique values in the list remain? I thought about doing some nested for loops to compare the two lists, but it seems a bit messy. Is there a ...
2
votes
2answers
61 views

How do static and member variables behave in a. stateful batch classes?

Suppose I have a batch job and I want to maintain state (i.e. want to keep a log of the record ids that I've processed, or keep a running total, or something). When would I use class variables vs. ...
4
votes
2answers
135 views

SOQL Query Where Id “In” Versus “Equals”(=)

I just stumbled upon a soql query where somebody did the following List<String> names = new List<String>{'John', 'Moe', 'Jeanette', 'Tony'}; List<Client__c> clients = [ SELECT ...
0
votes
2answers
22 views

System.TypeException: Invalid date/time: 2019-01-03T00:26:01.711-02:00

Im trying to format this String into DateTime. String 2019-01-03T00:26:01.711-02:00 Code String data = '2019-01-03T00:26:01.711-02:00'; Datetime dt = DateTime.parse(data); Exception System....
0
votes
1answer
19 views

Lightning component button refresh

I have a lightning component button that updates the status of a case when clicked in Lightning. Is there a function that I can use to have the page refresh when clicked because as of now, I have to ...
-2
votes
0answers
16 views

convert Bulk of Leads,ten thouand. one by one serially.my leads are in csv.any ..? [on hold]

global Database.QueryLocator start(Database.BatchableContext context) { return Database.getQueryLocator([SELECT Id,LastName,LastModifiedD__c FROM Lead ]); } global void execute(...
1
vote
1answer
38 views

Select Knowledge object in SOQL query

I'm trying to get all articles which are published and online. In my user I turned on all permission set and so one to have access to Knowledge. List<Knowledge__kav> myList= [SELECT Id, ...
0
votes
0answers
13 views

How to get column values properly in excel from vf?

We have created vf page that returns excel file. for 4 columns the values are updating randomly in excel. Please check the screen shots and code. The node1,machineid1, node2,MachineId2 columns are ...
-1
votes
2answers
23 views

Disclaimer Popup on Chatter Group [on hold]

I want to add a disclaimer message on a chatter group. When new user join chatter group he/she needs to accept disclaimer message. Can anybody help me on this because there is no standard way to do ...
0
votes
0answers
17 views

how to conditionally render a gauge chart based on values of a numeric array in Visualforce

controller--snippet if(pos >=0 && pos <assTElist.size()){ lstTrans = [select Maturity_Assessment_Question_ID__r.Transformation_Element__c fa, ...
0
votes
1answer
25 views

My Test Class Isn't Passing

I have a test class which is testing a controller but I cannot get the test to pass. Here is the controller class: //a controller class to get incidents for display on VF page and then //anonymise ...
0
votes
2answers
25 views

can we use multiple extensions with custom controller

My first doubt is can we use multiple extensions with custom controller. If yes, please check below code and let me know can I call "dosomething" method of Ext2? Ext1: public with sharing class Ext1 ...
-1
votes
1answer
16 views

queried inside controller so how can i access id in that through apex test class?

How can I test below code which is inside controller? public with sharing class AccountDetails{ public Id accRecId; public List<account> accRec { get; set; } public ApexPages....
0
votes
1answer
19 views

How to insert a dummy value for custom metadata setting

I have a batch class and in the constructor of the class, I have a query in which it queries for a Queue. Constructor: public BatchClass(){ final String QUEUE_NAME = GlobalPropertyCache.getValue('...
0
votes
0answers
17 views
0
votes
1answer
22 views

getting Unexpected parameter encountered during deserialization using REST service

why below REST web service does not properly deserialize the input argument?Please help me out? @RestResource(urlMapping='/HH_Survey/*') global class HH_SurveyController { public ...
3
votes
2answers
39 views

Need help understanding this apex trigger example

I'm just starting out in apex. I want to create a trigger that counts the number of attachments in a record of a custom object. I came across an example here. Here's the trigger code: trigger ...
0
votes
2answers
26 views

Second apex method executing before the first one finishes

I have a vf page displaying several Multi select custom buttons. And I am calling a apex method every time one of the button is clicked from VF page using actionfunction. But if I click 2 buttons in ...
0
votes
0answers
11 views

unable to convert WSDL to Apex, getting Error: Failed to parse wsdl: targetNamespace not specified in wsdl:definitions

below is code <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsse:Security xmlns:wsse="...
4
votes
0answers
19 views

Cache.Session not honoring ttlSecs argument?

I'm using session cache and trying to set the TTL (lifetime) to 60 minutes. However it is expiring much more quickly (it appears to be using the default 5 minute expiry). The docs say TTLs is ...
0
votes
0answers
15 views

Maintain the State of a Controller when Opening a Shared Controller VF page as a Console Tab

I am trying to pass all of the values from an object from one Visualforce page to another. objX is queried for two fields id and fieldOne and stored in a list on the controller: listObjX The object ...
-4
votes
0answers
25 views

Convert Process Builder logic to code [on hold]

I am trying to convert PB logic to Apex class and call the Apex class from a trigger on custom Object. Can anyone help me with writing the Apex class? The Process Builder updates a checkbox on ...
0
votes
0answers
23 views

Insert ContentVersion without VisualForce

I've got a CSV file stored on the user's hard drive and I want to store it in Salesforce. The code I have uses Visualforce and Apex to, I think, open up the file and place the contents on a hidden ...
2
votes
2answers
49 views

How to access Class members decorated using { get; set; }

I'm trying to save on boilerplate code so tried to use { get; set; } idiom, but the function will not resolve. This is the class with decorated properties. public class Counter { private static ...
-1
votes
0answers
15 views

Get Wrapper Fields Names Run time [duplicate]

Suppose, i have a wrapper class with 5 variables to fill. So just wondering can i create a list of all these values and while calling a wrapper, can i use the map to retrive variable names of wrapper ...
0
votes
0answers
12 views

Not full URL in Referer header in a controller of a Visualforce page

I added a custom VF page in a Dashboard. I want to have the Id of the Dashboard in my controller because I need it in my script. So, I used ApexPages.currentPage().getHeaders().get('Referer'). In ...
0
votes
1answer
24 views

Salesforce SOAP Integration

Req :- Custom Settings :- Vacancy Media Fields:- Name Type Area Path Map -- ...
0
votes
2answers
43 views

How to login salesforce user programmatically?

I require to login certain users among the test users created in test classes. Each user is created as follows: User user = new User(Alias='test', Email='test@none.com'); insert user; I create ...
1
vote
2answers
22 views

Could not resolve the entity from <apex:inputField> value binding ---

Could not resolve the entity from value binding '{!pizza_name}'. can only be used with SObjects, or objects that are Visualforce field component resolvable. apex class public class pizza_menu { ...
0
votes
2answers
19 views

How to create a condition for apex:inputField value field which gets a boolean expression from a method from controller?

I have the function which returns the boolean value and I want to use it in the VisualForce page in the following way: <apex:inputField id="reason" value="{!if(!isReason()): Case.Reason__c = 'No ...
-1
votes
0answers
24 views

Create a task based on Date/Time field value [on hold]

I have a requirement where i need to create a task based on a field value: In case object I have a custom Date/Time field called 'call_me_Back__c' that I wish to create a new task ('subject= call', '...
1
vote
1answer
20 views

unable to fetch latest attribute value in lightning

I have picklist in lightning. On onchange fuction it is getting a data from apex method and setting it in a attribute. And just after that when i trying to fetch the value of that attribute. I am ...
1
vote
1answer
26 views

Invalid character in identifier in Wrapper class

I am doing a rest call with the below endpoint string endPoint = 'https://test.salesforce.com/services/data/v43.0/query?q=SELECT+Name+,+RecordTypeId+,+Code__c+from+Account'; I have the below class ...
0
votes
2answers
47 views

Not able to insert multiple records on other object by using trigger

I have two custom Object name Loan and EMI. Now whenever new Loan is created with Fields Loan_Amount , No_of_EMI and others fields , multiple rows(=number of emi accounts) should be created in EMI ...
1
vote
2answers
65 views

Is there a way to determine if an object supports list view?

Is there a way to determine if an object supports list view? I've developed a VF page which shows a list of Objects and based on Object selection it shows list views of that selected object. For some ...
0
votes
0answers
25 views

Getting parent Id when clicking new button from related list

Object A is the parent object and object B is child object. object B has new button override with VF page. when I am clicking the new button of obj B from related list A I need Obj A's Id. For this I ...
0
votes
0answers
6 views

Authenticated Callout to Webservice using SSO

We are facing the following problem. We need to make webservice callout through Mulesoft in a way the user is making the call is not a service user, but the logged one: Both Salesforce and ...