Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

Notification not getting fired from apex

I have added a component added on the community site that fetches details from an external system and fires a notification whenever the page loads. The response which I get as follows: "custom&...
code234's user avatar
  • 186
1 vote
0 answers
21 views

Aura Component - Lightning Page Template - Collapsible region not resizing correctly

I am trying to create a Lightning Page Template aura component that has two equal sized regions. Between the regions is a button which when clicked collapses the left region, and the right resizes ...
Tom Young's user avatar
0 votes
0 answers
38 views

Assigning OwnerID to Task in Test

When creating tasks in test I am unable to assign an Owner ID (user) - insert task fails with cross reference error. // Create a Task record System.runAs(systemAdmin){ Task task = new Task(); ...
Jack F's user avatar
  • 1
1 vote
1 answer
27 views

Not able to share files with external users

We have a use case to share files created by internal user to be available to the external users automatically. The external user is the owner of the record, but still cannot see the file uploaded by ...
Mitesh Sura's user avatar
0 votes
1 answer
26 views

How to decrypt an encrypted incoming webhook payload

I have set up a webhook in an external system to send data to my salesforce sandbox. My sandbox is getting the webhook payload but its encrypted. This is my Apex Class @RestResource(urlMapping='/...
sfNewbie's user avatar
0 votes
0 answers
14 views

Expected name collision behavior between 2GP managed package and 2GP unlocked package with same namespace

I am trying to understand the expected behavior for the following scenario: Under the same dev hub, I have developed a pair of 2G packages. Both of them share the same namespace (myns): Package A: 2GP,...
jonathanrico's user avatar
-1 votes
1 answer
49 views

DML operation Insert not allowed on Survey in the test class

I'm creating a test class for the Survey objects like: Survey, surveyResponse, surveyQuestion, and SurveyQuestionResponse. getting an error: DML operation Insert not allowed on Survey and for all the ...
Mohammad Arbaz's user avatar
0 votes
0 answers
24 views

I want to get rowid in vf page table . List has no rows for assignment to SObject

Controller class public class BankDetailsController { public list<Bank__c> banklist {get;set;} public boolean displayPopup {get; set;} public boolean displayPopupTwo{get;set;} ...
Shreyas Shirke's user avatar
3 votes
1 answer
49 views

How to Check if LWS (lightning web security) is enabled inside Apex or LWC

I would like to experiment with dynamic LWC components in my managed package. I also would like to keep the option for some clients to use my package in case some other package requires keeping the ...
1 vote
0 answers
42 views

Traversing SObject Schema Relationship Depth Recursively

I'm trying to build a list of creatable and updatable lists that I will use later in my code to check for FLS, I want to allow a relationship depth of 2 and would like this to be changed at some point ...
Roy's user avatar
  • 11
2 votes
1 answer
76 views

Apex: Ternary operator and SonarQube warning

I have the following Boolean assignemnt: Contact currentContact = new Contact(); currentContact.Is_Manager__c = UserWrapper.isManager() != null ? UserWrapper.isManager() : false; UserWrapper class ...
Teo's user avatar
  • 21
1 vote
1 answer
58 views

My APEX codes are returning wrong datetime?

Can anyone help me? Seems like the following line of APEX codes are returning wrong time? I am in Malaysia timezone & the login user who is executing these line of codes is in Sydney timezone. The ...
herethere's user avatar
0 votes
0 answers
22 views

I need to send an email with a batch Class that summarises all opportunity amounts

I just don't know why this code does not work, if anyone has any suggestions, i'm happy to hear them! public with sharing class OppAmountForAccount implements Database.Batchable<sObject> { ...
Florin Hreniuc's user avatar
-2 votes
1 answer
40 views

Can we rely on reference when it comes to changing Map items changing?

My code for(FieldDefinition def : [SELECT QualifiedApiName, EntityDefinitionId, EntityDefinition.QualifiedApiName FROM FieldDefinition WHERE EntityDefinitionId in :...
pincet's user avatar
  • 911
0 votes
1 answer
23 views

Apex call returns successfully after errror, resulting in issues

I have an Apex call which causes an error (ENTITY_IS_DELETED, but it doesn't matter which error it is). I might be able to fix that error, but now it somehow also returns successfully anyway, so the ...
Z0q's user avatar
  • 59
0 votes
1 answer
21 views

Error while updating Lookup field on Case recprd after insert from Web-to-Case form

I'm trying to update the lookup field (Account ID) using the trigger after inserting the Case record by using the Web-to-Case form. But it is throwing the error "FATAL_ERROR|System.FinalException:...
RKCY's user avatar
  • 323
1 vote
1 answer
83 views

NavigationMixin - file preview - Failed to Load inside slds-file_card div

Is there any workaround to display a file preview under slds-file_card div, when I click the image HTML: <template> <div class="slds-p-around_none slds-var-m-top_x-small slds-var-m-...
Ragul's user avatar
  • 541
0 votes
1 answer
29 views

How can I discover the users and emails from a group email using Apex?

Is it possible to discover the name of the many users and emails from an Microsoft Outlook group email (eg. [email protected]), Is there a way to discover this information using ...
Angelo Rigo's user avatar
0 votes
0 answers
61 views

Create Parent Records from Child Records using Dynamic DML

I'm trying to create corresponding parent records in salesforce (Ex. Account, Parent Account) from child (Opp/Case) records based on a incoming JSON file. The external system does not need or use the ...
Roy's user avatar
  • 11
3 votes
1 answer
57 views

Why does `EntityDefinitionId` works like SObjectType in following code?

Let's say I want to retrieve all the fields with master-detail for each objects for given PermSet. Why can we provide SObject type array instead of Ids? And how can I can retrieve SObjectType as well ...
pincet's user avatar
  • 911
1 vote
0 answers
25 views

How to set scope in Auth provider for extending token expiry on JIRA server?

While setting up named credentials or Auth provider using OAuth2 for connecting to Jira on premise, The incoming link in JIRA is configured correctly and I am able to pull data but the session expires ...
goose's user avatar
  • 81
5 votes
1 answer
103 views

How to write SOQL query to get accounts where billing city equals to shipping city in single query?

This question asked in interview. As per my knowledge, it's not possible to get in single query. Is it even possible? If yes, then how? Please answer this question. Thank You!
nikita yadav's user avatar
0 votes
0 answers
13 views

salesforce => SendEmailResult => duplicate value found: <unknown> duplicates value on record with id: <unknown>

First thing first, I have gone through this thread where "duplicate value" is discussed - How to debug the mysterious "duplicate value found: <unknown> duplicates value on record ...
Mitesh Sura's user avatar
-1 votes
0 answers
36 views

How to Implement the rate limiting in the forget password

Can you please guide me, How to Implement the rate limiting in the forget password number of password reset emails to 5 per hour per email address. Set up a verification mechanism to track the number ...
Chittu Kala's user avatar
0 votes
3 answers
68 views

Verify Email addresses in LWC

I have a LWC component in which one of the part i am sending emails , but here i want to check that the emails are exists in real world or not for now i am just doing the format validation in JS that ...
NewBaySales's user avatar
0 votes
0 answers
18 views

Uninstalling a Package

I have a package installed in my Salesforce org. I also noticed growing numbers of SOQL queries. I would like to know if removing the package would affect any existing records and is there a way to ...
Ashley's user avatar
  • 1
1 vote
1 answer
35 views

Formula Field - Apex code issue

I have two custom objects, PG and Funding Source. Within the PG object, there is a field called Date_of_Birth__c, which is a formula field that pulls the DOB from the contact. This field shows up fine ...
Daniel S's user avatar
0 votes
1 answer
29 views

Property type misidentification in VisualForce Page

I'm deploying all the code from a 1stGen Package to a new Scratch org, to improve our development/testing/release process. There were a few deploy errors but I've fixed all but two types. This is one ...
cyberspy's user avatar
  • 210
3 votes
1 answer
90 views

Moving code from unlocked package back to "happy soup" - how?

We've been experimenting with moving some of our code into unlocked packages, however we'd like to understand how to back-out of this if necessary. As a test, we moved a bunch of "utility" ...
James's user avatar
  • 205
0 votes
0 answers
42 views

Get master object from master-detail relationship by SOQL FieldDefinition object

Let's say we have SELECT DataType FROM FieldDefinition WHERE EntityDefinitionId='Opportunity_ROW_Segment_Junction__c' it works fine but is it possible to retrieve e.g. Opportunity as a single field ...
pincet's user avatar
  • 911
0 votes
1 answer
64 views

system.limitexception: too many callouts: 101 error Salesforce

public with sharing class ToolingAPIUtility { public static final String endpoint = '/services/data/v51.0/tooling/query/?q='; @InvocableMethod(label='Get Alert Data' description='Get Alert ...
Sahir's user avatar
  • 3
1 vote
1 answer
59 views

I need to create a batch class that summarizes all Opportunity Amounts for each Account;

An email should be sent to the primary contact of all Accounts, containing a table with the Closed Won/Open/Closed Lost summarized Opportunity Amounts, but no matter how much i try and change the code ...
Florin Hreniuc's user avatar
-1 votes
0 answers
22 views

Unable to delete Batch Apex class from org [duplicate]

I am not able to remove apex class from sandbox nor production org. When I try to delete the class it gives me message: [...]Apex Job This Batchable class is in use - Batch Job IDs: [...] (note: not a ...
Kacper A's user avatar
0 votes
0 answers
28 views

Prettier, in VS Code, failing to format SOME VF Pages

I'm using Prettier, along with the plugin prettier-plugin-apex in VS Code, to format Salesforce classes and Visual Force pages etc. It works (formats my docs on Save) most of the time, but now some, ...
cyberspy's user avatar
  • 210
0 votes
0 answers
16 views

Is it possible to Approve a ProcessInstanceWorkitem as another user in a Test Class?

I'm trying to approve a ProcessInstanceWorkitem as its ActorId in a test class, but I'm receiving the following error: System.DmlException: Process failed. First exception on row 0; first error: ...
Cassio's user avatar
  • 3
0 votes
0 answers
42 views

Image is rotating to left in Visualforce Page using RenderAs="pdf"

I'm facing an issue: I'm creating a PDF and using the image stored in the files object. I'm creating a Visualforce page with RenderAs="pdf". The image is appearing, but it's rotating to the ...
Aditya Narwade's user avatar
0 votes
0 answers
17 views

Problem with pages numbers in knowledgeArticle via REST API

I am creating a pagination of the knowledgeArticle object. after query execution: /services/data/v52.0/query/?q=select+count()+from+knowledgeArticle I receive the quantity: totalSize: 1349 Then I ...
Kamil G.'s user avatar
1 vote
1 answer
82 views

LWC Wired method not working

I have a controller with a apex method which takes a user id. This controller is used in a LWC component. Here is where I am trying to call the apex method via a wire method. This is done in a ...
Liam's user avatar
  • 121
1 vote
0 answers
38 views

System.CalloutException: PKIX path building failed: unable to find valid certification path to requested target

Sorry for the unexpected appearance, I saw your profile on the forum dealing with the error: System.CalloutException: PKIX path building failed: sun.security.provider.certpath....
Banzoni's user avatar
  • 11
1 vote
1 answer
28 views

How to wait for a VisualForce script to execute when calling it from an Apex method via PageReference?

I have an Apex controller MyController which calls a VisualForce page via PageReference. Here is my controller: public with sharing class MyController { @AuraEnabled public String param1 { get;...
ViqMontana's user avatar
0 votes
1 answer
36 views

How to prefill lookup value in lightning web component

I have a requirement to create a task on opportunity with prefilled values from custom fields on the opportunity. I have a lightning web component on the opportunity detail page which I want to use ...
Thomas's user avatar
  • 2,298
0 votes
0 answers
21 views

Will Large Data Volumes Affect the Performance of Custom and Activity Objects?

We plan to associate a custom object with the activity object to record the actions of our sales personnel. Based on our preliminary estimates, both the custom object and the activity object will ...
Lex's user avatar
  • 11
-1 votes
0 answers
24 views

Session Id generated through postman and apex class are not identical

I am facing issue with session Id. Whenever I am using post request in postman the request is generating the url correctly. But when I did same post request through apex class it's generating ...
Pratik Patil's user avatar
2 votes
1 answer
96 views

Why isn't my Salesforce test method returning null when querying a deleted record created in TestSetup?

I have a Salesforce test class with @TestSetup alongside two test methods. In the last method (testQueryDeletedRecord), I attempt to query a record that I deleted in a previous test method (...
Licytede's user avatar
3 votes
1 answer
50 views

Salesforce Apex Access Nested Lists after Parsing JSON with Wrapper Class

I think I am just missing something simple - using very simplified and generic code for example. I have some JSON: { "level1":[ { "level2":{ "id&...
Dar Wright's user avatar
0 votes
0 answers
30 views

EMAIL IS NOT GOING IF ATTACHING 500KB or Above

I am trying to upload file of size between 1MB and 2MB using LWC component and after upload saving the same file as an attachment and sending it in an single email as an attachment. I am able to ...
Learner's user avatar
  • 21
0 votes
0 answers
30 views

Traversing variable thru batchable steps

Let' say we have this class global class ObjectPermsBatch implements Database.Batchable<sObject>, Database.stateful { Id permset; List<ObjectPermissions> permSets = ...
pincet's user avatar
  • 911
4 votes
1 answer
214 views

Optional chaining - change

I have code in production for many months and it start to be problematic. this code involve if condition with Optional chaining. Here is an example List<case> cases = [Select id, Status__c FROM ...
Raphael D's user avatar
  • 616
2 votes
0 answers
50 views

Converting Rendered Email Templates to PDFs - issue(s)

I'm hoping someone here will be able to help me as I have been trying different "solutions" for days now...to no avail. I am new to Apex and do have some Java in my backgorund...not much ...
greeng13's user avatar
0 votes
0 answers
36 views

Future method not getting called in Auth providers

From out external .Net application after user log in by clicking on one card we are redirecting the user to our salesforce community sites. In order to establish SAML communication under Auth ...
SFDC-Beginner's user avatar

1
2 3 4 5
738