Stack Exchange Network

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

0
votes
0answers
5 views

How to validate a encrypted field

on the best practice section of this documentation: https://developer.salesforce.com/docs/atlas.en-us.securityImplGuide.meta/securityImplGuide/fields_about_encrypted_fields.htm it says: You can ...
1
vote
1answer
19 views

Error not bubbling up from delete trigger

I need to prevent deletion of our dummy account, which is part of the Lead conversion process under certain conditions. And it does prevent deletion. However, the error I am adding to the account ...
1
vote
0answers
18 views

Need to reconfigure Process builder formula

Person Accounts is enabled Have multiple record types on Accounts (a few for 'Accounts' and a few for 'Person Accounts' They have an old process that was implemented, but we re-architected the ...
0
votes
1answer
18 views

Trigger is only updating one record per batch

I have a trigger that creates an AccountTeamMember object every time there is an update to an Account_Ownership__c object (this is a custom object that we've created in house to act more in line with ...
-1
votes
0answers
32 views

Calling Tooling Api From Apex with Named Credentials,Auth,Connected App

We need to get some custom field ids thru apex - we are doing it by the tooling api - but this needs to run from the admin user because of the permissions View Setup and Configuration. We cant use ...
0
votes
1answer
22 views

How to See Scheduled Job Run History

I have a scheduled job that is supposed to run every night at midnight. Recently users have said that the job didn't run; however this is sporadic, some nights it works and others it doesn't. Is ...
0
votes
2answers
40 views

How to get the response data in @future(Callout=true)

I need to catch the response of a callout method and insert it into a database. But what the problem is, the callout method called from a trigger. Therefore, I have to add the annotation @future(...
0
votes
0answers
12 views

Copying fields data when checkbox is checked in multiple rows(Visualforce Page)

I have challenge I'm working on a visualforce page I want whenever the checkbox is checked I want to copy the values into input text fields in visualforce page. So here I have multiple rows and ...
0
votes
1answer
34 views

System.QueryException: Inline query has too many rows for direct assignment, use FOR loop

I have a batch executed : 1 out 4200 is failing with : inline query has too many rows for direct assignment,use FOR loop My code in the exec function: List<String> personAccountsIDs = ...
0
votes
0answers
8 views

Group mention is not working with custom chatter functionality

I am using the Connect API to create a custom feed. This is working fine when I am using user in @mention but when I am using the group in @ mention it is not doing the feed post an exception is ...
-3
votes
0answers
24 views

unable to get the row id on click of Add button in vf page

I have a one vf page where i am displaying list of rows and each row with one add button. My requirement is on click of Add button i need Id to be captured in list in controller.
3
votes
1answer
18 views

What are “LOB fields” in an asset? Querying all the fields on the asset causes a limit exception, why?

First of all: what are LOB fields? Secondly: I have a complex apex automated process in which I need to make an exact copy of an Asset object (all of its fields). To do this I created a method that ...
2
votes
2answers
78 views

Illegal assignment from sObject to Id

I'm trying to insert two master-detail lists at the same time. I'm looking through Bob Buzzard's blog post: http://bobbuzzard.blogspot.com/2012/03/create-parent-and-child-records-in-one.html Where he ...
2
votes
1answer
20 views

Adding null to Set<Id> doesn't return an empty Set

Set<Id> testIds = new Set<Id>(); testIds.add(null); system.debug('testIds are ' + testIds); system.debug('Size of the set is ' + testIds.size()); system.debug('isEmpty result is ' + ...
1
vote
1answer
14 views

How to resolve Attempt to de-reference a null object in Apex Controller

I am trying to bind my map value to wrapper class in apex controller . I am getting System.NullPointerException: Attempt to de-reference a null object. I couldn't understand where I am going wrong. ...
1
vote
4answers
270 views

Multiple OR (||) Conditions in If Statement

Can anyone explain why the following If statement does not work with multiple OR conditions. The goal is when this trigger runs, if the user's Id who is updating the record is not equal to a specific ...
0
votes
0answers
31 views

How to organize Apex Classes for large projects in a single folder?

A traditional Org stores all its Apex classes within a single folder. If you are working with a dozen developers on a large project, this leads to chaos: You end up with either hundreds of small ...
0
votes
0answers
16 views

How to validate the <apex:inputfields> on form submission and show error using SLDS?

I am using SLDS in a VF Page and I am referring to this link here to show error. The problem is the error is displayed on page load because I am not removing the Slds-has-error class. But, how do I ...
2
votes
2answers
80 views

Benefits of using sObject.clone versus creating a new record

Hello I am curious whats the use case of the clone method. Also when its beneficial. Example here I create a lead once then clone it 200 times. list<lead> leadlist = new list<lead>(); ...
0
votes
1answer
15 views

Refresh Lead Status (Path) in APEX

I currently have a flow, which calls an apex class on completion. This class changes my Status/Path of the lead. I want to refresh the path (lighting component), when my flow finishes or when the ...
0
votes
2answers
22 views

Problem adding elements to a Map

I have the following for loop: for(FGM_Base__Benchmark__c bmrecords:[ select id, Number_Completed__c, ( select id, FGM_Base__Number_Update__c, Status_Grantee_Report__c from ...
0
votes
2answers
16 views

Multiple Child Records from Parent Related List: Url No longer exist

I need to create Multiple Child Records from Parent Related List but i get the Error: "URL No Longer Exists" but the data saved in the database. Also, it seem that the Parent Id does not populate ...
0
votes
2answers
27 views

Problem setting value of text in lightning component from js helper

So I created for te first time a lightning component and I'm just getting familiar with it all. What I did was create the apex controller, the lightning component, the js contoller and the js helper. ...
0
votes
1answer
16 views

What is the transaction boundary in apex and how the debug log files generated?

In Apex Developer Guide, I found An Apex transaction represents a set of operations that are executed as a single unit. My question is, how can I define the set of operations ? That is, If I ...
0
votes
1answer
18 views

Email Services - Add setReplyTo email while sending email from record detail page of an object

I have created an email service and got an email address like email_handler@9w9wya19o...... I want to capture the email response of email that I am sending from the record detail page but I am unable ...
1
vote
0answers
28 views

Unable to compare Date value returned from SOQL within next SOQL where clause date field

Not able to compare dates returned from one SOQL as a list into another SOQL's where clause: ApexCode to store all date data into list: List<Account> a = [SELECT ID, FIRSTNAME,PersonContactId,...
0
votes
2answers
28 views

@AuraEnable Server side controller not executing properly (not showing debug log)

I have this component that is available from a Community, where an object gets populated and passed to Apex controller in a JSON String. From the server side, it should show via debug what I ask, but ...
-2
votes
0answers
13 views

Unable to get Campaign in Lead even there is standard lookup [duplicate]

I try to fetch the lead records as List<Lead> ld=[Select id,name,Campaign from lead]; but I am unable to fetch the records. it showing an error ERROR:-No such column 'Campaign' on entity 'Lead' ...
1
vote
1answer
29 views

Command Button not saving!

The command button on my Visualforce page is not saving edits to the record. Any help is appreciated! Visualforce Pg: <apex:page action="{!redirectToPartnerships}" extensions="EditExtensions" ...
0
votes
1answer
18 views

Visualforce component to display formatted currency [duplicate]

I have a component that I am using with a visualforce email template. It's a simple table that I get from a controller query to display Opportunity Products. I want ot format the totalprice field so ...
0
votes
0answers
26 views

On creation of ContractLineItem getting FIELD_INTEGRITY_EXCEPTION

I am creating a ContractLineItem record on the creation of ServiceContract by using a trigger. Below is the error I am getting Error: Invalid Data. Review all error messages below to correct ...
2
votes
1answer
31 views

Salesforce Community - Can we use cookies to only show a visitor a popup once?

I have a client with a Salesforce Community website who wants to have a pop-up on the homepage, but they only want it to pop up one time per user. This is before they login, so I'm thinking what I'd ...
0
votes
0answers
11 views

How to distinguish the Chat Button with Einstein bot and without bot?

I'm trying to make two picklist, using visualforce and apex controller. In the first chat buttons without Einstein bot in the second one with Einstein bot. This is an example of how it should look: ...
0
votes
0answers
17 views

Use the Salesforce Lightning Design System to Style Visualforce Pages Issue

Working through the Visualforce Mobile module I want to do an exercise (3rd unit) that consists of displaying the contacts their names and phone numbers. <apex:page showHeader="true" sidebar="...
0
votes
1answer
17 views

Single Email limit per execution using Apex Trigger

How many emails will be send using trigger per execution?
0
votes
0answers
10 views

apex code download from FTP server [duplicate]

We need to develop a batch which will download apex code from a FTP Is it possible to do that with Apex or an AppExchange please? I search but no useful response..
-4
votes
0answers
29 views

I have a trigger with handler, and done test class as below,please let me know any further modifications required [duplicate]

Trigger: trigger SetExpenseManagerAndFinanceManager on DA_Expenso_App_Expense_c (after insert, after update, before insert, before update) { if(Trigger.isBefore && Trigger.isInsert){ ...
0
votes
1answer
28 views

How to create a bidimensional array of Strings and acces it

I'm building a trigger that everytime a Campaign Member is added , Salesforce sends an email to the Owner of the Account where the Contact Lives that a Campaign Member is added. Due to Salesforce ...
0
votes
0answers
34 views

Salesforce Apex Error

Sync down of settings is failing in salesforce mobile native swift app.The error from salesforce is NSLocalizedFailureReason = APEX_ERROR Sync type:syncDown id:1 FAILED cause:Server call for sync ...
0
votes
1answer
30 views

soql Expression cannot be assigned

list<dnc_suppression__c> dncsup = new list<dnc_suppression__c>(); dncsup = [ select id, vin__c, DNC_Owner_Ind__c, First_Name__c, Email_Ind__c, Campaign_ID_1__c, ...
-2
votes
0answers
30 views

I want create login and register page by using Visualforce [on hold]

I am new to salesforce. I want to create login and signup pages. Data from signup pages should get saved and after that there should be successful authorization in login page.
0
votes
0answers
24 views

Lightning Page - You have uncommitted work pending. Please commit or rollback before calling out

I have some issues with my lightning Page. There are some lightning components who are filled with some data that came from more than one service. There is a component Asset Contact, the data from ...
0
votes
1answer
12 views

Search in All Fields plus topics for feeditems

I currently have an SOSL query [FIND :finalSearchText IN ALL FIELDS RETURNING FeedItem(Id, Title WHERE Type = 'QuestionPost') LIMIT 10]; This works great for searching the feed item title and body. ...
1
vote
1answer
36 views

Apex code coverage and static boolean recursion flags

I've written two Apex Triggers, one on the Opportunity object, and one on a custom object. These two triggers keep the two objects' checkboxes in sync; setting a value on one object's value sets the ...
0
votes
0answers
21 views

Invocable Apex working when called from Process Builder but not Flow - what's wrong?

I have an invocable method that works just fine when I pass a Contact record Id to it via Process Builder. I'd like to use Flow to do this rather than PB, but get this error message: Error Occurred: ...
0
votes
1answer
32 views

How to move a SOQL query that contains a loop variable, out side of for loop?

I'm new to Apex and need to assign a User to a Contact via lookup field on the contact record based off of the user with the least amount of assignments and matching endpoints (account name custom ...
0
votes
0answers
17 views

How to implement button on a Contact page that calls an Apex code providing that contact's Id (Lightning) [on hold]

I would like to create a button on top next to 'new case', 'new note' etc And by clicking it sends the contact's id of the current page to a function in an apex class. So far, all the solutions I ...
2
votes
1answer
21 views

Showing error using SLDS Has Error on Apex:Inputfield with Aria-describedby

I am using the SLDS in visualforce page and trying to display error next to the component by following this. But aria-describedby does not work with <Apex:inputfield> and throws error. Here's ...
0
votes
0answers
19 views

AccountTeam Member is not getting Read/Write access on Account?(Updated)

I had posted the similar question earlier: AccountTeam Member is not getting Read/Write access on Account? Below is same code: private void UpdateAccountTeam(Map<Id, SObject> newItems, Map<...
-4
votes
0answers
27 views

I wnat to upload CSV File in custom object [on hold]

I want upload a csv file but i got error from catch block. Please find error and tell me where i am wrong in the code. Apex Code - Class Name - RentLimitProcess :- public class RentLimitProcess { ...