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
20 views

notifyRecordUpdateAvailable vs RefreshApex vs RefreshView API

RefreshApex works for me so far in almost every case. I'd like to understand why I would instead use notifyRecordUpdateAvailable or the RefreshView API instead. Or am I horribly misunderstanding the ...
Ethan's user avatar
  • 11
0 votes
1 answer
13 views

Need help increasing the code coverage for this trigger

I'm a newly hired Salesforce admin and I've been struggling to deploy this trigger since this code is completely new to me. I've been trying to deploy a new version of a trigger with, at most, 10 ...
Humberto Cárcamo's user avatar
0 votes
0 answers
18 views

Schedulable batch Test execute org data and throw database Error

Test class User u = new User(Alias = 'xxx', Email='xxxxx', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = xxxx, TimeZoneSidKey='xxxxx', ...
SFL's user avatar
  • 1
-1 votes
0 answers
17 views

Not able to see debug logs for class which implements commercepayments.PaymentGatewayAdapter salesforce OMS

I have created Adapter class in salesforce using Example Adapter classes provides on git. It captures and returns the payment as expected. But if requestType is commercepayments.RequestType....
mayur pardeshi's user avatar
1 vote
1 answer
30 views

Salesforce Account Merge Trigger Execution in Bulk Scenarios

I came across the information regarding the execution order of triggers during the merging of Salesforce accounts, as discussed in this SF Stack Exchange thread: merge-trigger-execution-order. The ...
Salvation's user avatar
  • 1,147
-2 votes
1 answer
33 views

Implementation of hash map

public class Person { private String First_name; private String Last_name; public Person(String First_name, String Last_name) { this.First_name = First_name; this....
Vinay Kumar's user avatar
1 vote
1 answer
33 views

Share Content Version to Admin Users

I am creating my file using the following code: ContentVersion cv = new ContentVersion(); cv.VersionData = pdfContent; cv.Title = fileName; cv.PathOnClient = filename; cv.Description = 'to-be-...
Carl Ortiz's user avatar
1 vote
0 answers
21 views

Issue with ConnectAPI.NamedCredential Class

I am trying to utilize the NamedCredential Class. The getNamedCredential method works but the getExternalCredential method does not. I am able to see the external data from the named credential call ...
Mac Nosek's user avatar
0 votes
0 answers
41 views

AWS Signature expired (X is now earlier than Y (Z - 5 min.)

I am currently working to integrate SF with AWS (Textract service to be precise) but I cannot get rid of this message: {"__type":"InvalidSignatureException","message":&...
julianbesso1's user avatar
0 votes
0 answers
19 views

Date range filter using JQuery DataTable with Salesforce as server side

I have a requirement where I need to put all the TXN__c records in a table where I have more than 50,000+ records that's why I use server-side. On load I can now get what I want. My next challenge ...
Fer Catapang's user avatar
0 votes
0 answers
38 views

Update Custom Datatable LWC Whenever Related ContentNote is Created/ Updated

I have created a custom datatable to display contentnotes related to an account record. I would like this table to update whenever a new contentnote related to the account record is created or updated....
spal's user avatar
  • 53
0 votes
0 answers
21 views

Page is showing blank in salesforce energy and utility cloud

In Salesforce Energey and Utility cloud, when I am setup the customer account after filling the forms, when I click on Confirm Move In, button, it opens up the page, where I have to fill the details ...
Harry's user avatar
  • 1
0 votes
0 answers
26 views

Create valid Messaging Session with Apex for outbound WhatsApp message

Today I have an Apex job that sends multiple messages every couple of minutes. So.. if the receiver doesn't have a related MessagingEndUser, I create it before sending the message; I apply some ...
Gabriel's user avatar
  • 11
-1 votes
1 answer
37 views

Show custom error message instead of 'Internal Server Error' in postman

Is there any way in apex to show custom error message like 'Invalid Parameter' instead of 'Internal Server Error' when wrong header parameter is passed in postman. I tried using 'throw new exception' ...
userName's user avatar
-1 votes
1 answer
35 views

Deserialize JSON in apex. JSON has object array [duplicate]

I have a JSON which I'm trying to deserialize into the apex class. JSON structure : { "resourceType": "Bundle", "entry": [ { "resource": { ...
Salesforce Dev's user avatar
0 votes
0 answers
24 views

@future(callout=true) AppExchange Package is Deprecated, Details: The AppExchange package has been deprecated and can no longer be installed

I'm experiencing an issue when trying to make an asynchronous HTTP call within an Apex Trigger using the @future(callout=true) annotation. The objective is to trigger a package installation via an ...
vctqs1's user avatar
  • 45
1 vote
1 answer
32 views

Can we add/create a duplicate field with and without namespace prefix in a same object

I have seen this type of scenario in one of the org, where the same field is present with and without namespace-prefix I want to know if is it possible, if possible can you please mention how to ...
Durgesh Patidar's user avatar
-2 votes
1 answer
20 views

Which is a better approach when updating records using batch class, to place it in execute or finish method?

Sorry but I am new to this and I just wander, do you think it is better to put all the millions of records inside the Map object which is process by the execute method, however the dml where the ...
Kato's user avatar
  • 1
-2 votes
0 answers
26 views

Refresh again and again the salesforce page [closed]

I have an issue that when we storing a data in custom object page why it has to refresh the page for rendering the data . In above image the fields which are in general layout that fill manually but ...
DEPASHIKHA MAHAPATRA's user avatar
0 votes
1 answer
38 views

How to determine when Queue is complete on LWC

I'm currently trying to create a tool that creates a metadata record in LWC. I'm using Metadata.Operators.enqueueDeployment(mdContainer, new DeployCallback()) to create a new record, and it's able to ...
Kevin Yao's user avatar
-1 votes
0 answers
43 views

Salesforce Schedule from Object [closed]

I am trying to see if it is possible to show an object as a schedule based on the start date/time and end date/time and have this as a calendar.
Brian Byrne's user avatar
0 votes
0 answers
52 views

Issue while using CometD in LWC to subscribe for platform event from another ORG

I am trying to subscribe to Platform event using the LWC component. Platform Event is being published from a different Salesforce ORG and I need to subscribe it in a different Salesforce ORG. I have ...
Dishant's user avatar
1 vote
2 answers
76 views

Batch Apex Class Invoked From Before Delete Trigger is not deleting Files Attached to accounts

I have written a batch class to delete the files related to an account whenever an account is being deleted. When I have tried the same code and logic without batch class it works fine. But in batch ...
Ameer's user avatar
  • 21
0 votes
0 answers
34 views

Delete in a Apex Test Class

I have this apex test class, the only problem with this is delete isn't being covered when running test. Is there something missing from this? @isTest(seeAllData=false) public class ...
Jaemy Malik's user avatar
0 votes
1 answer
29 views

Syncing data with legacy system

Because of the dreaded SOQL 101 limitation, I have a few flows that run with a delayed path. This is ok, as the processes in the flows do not require to be run instantly. However, in the delayed path ...
user2910531's user avatar
-1 votes
1 answer
65 views

apex list of object

I have a list of objects: List<Volume_Detail__c> listVolumesDetails = new List<Volume_Detail__c>([SELECT Id,Year__c,January_Volume__c, April_Volume__c,Volume__c FROM Volume_Detail__c ...
user avatar
0 votes
2 answers
54 views

Can we change Api Name of a field and change the Parameters and Return Type of an Aura Enabled Methods in a Patch Version

We have a Second Generation Managed Package which is live on AppExchange and we want to release a patch version with few changes. I have referred the Salesforce Documentation, still I have few doubts. ...
S1th's user avatar
  • 69
-1 votes
2 answers
48 views

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, execution of AfterInsert

My trigger is given below. Whenever new contacts are inserted, total_salary__c on the account object should increment or decrement trigger updateAccountSalaryNew on Contact (after insert,after update,...
sanu's user avatar
  • 11
-1 votes
0 answers
35 views

HTTPCall out request data is Invalid

I am doing a callout to Busness central endpoint . When I sent through Post man things are working fine but in APEX I am getting error as <error xmlns="http://docs.oasis-open.org/odata/ns/...
SFDC-Beginner's user avatar
1 vote
1 answer
97 views

HttpRequest to SAP encoding $ and space caracters

I have a wierd problem: I'm calling SAP from salesforce apex and I have trouble with one of my request. This one is working. request.setEndpoint(authentification_details.Webservice_enpoint__c+'/...
Julien Souchi's user avatar
0 votes
1 answer
26 views

Install package version via Metadata API in Apex class

I am doing automation on package installation after refreshing sandbox Found and follow this one https://github.com/litify/apex-mdapi/blob/55d755fc0c7e8d519dc10a5a3fa21aa0d7bda17b/apex-mdapi/src/...
vctqs1's user avatar
  • 45
-1 votes
0 answers
31 views

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

For the below Apex Test Class i am receiving System.NullPointerException: Attempt to de-reference a null object, Class.PFPLDeletedATFBackupRatingUpdateTEST.test: line 12, column 1 error Can someone ...
Vidyashree's user avatar
1 vote
1 answer
96 views

GCP created SObject is not immediately available in apex

I have a lwc component, in that, when clicking a link it will do a rest callout to GCP. GCP side will handle the callout, insert an SObject into salesforce, then return the newly created SObject id in ...
Lance Shi's user avatar
  • 13k
0 votes
0 answers
29 views

Integration with Dynamics 365 Business Central

We got new requirement to integrate with Dynamics 365 Business Central API.And below screen shot is from postman where in postman I can hit the BC and get the access token but I am trying to convert ...
SFDC-Beginner's user avatar
0 votes
1 answer
56 views

Method is available in sandbox but not in prod

I've composed an apex classes in sanbox, test classes as well. It works fine in sandbox. Now i wanna deploy to prod without using changesets and packages. a part of apex @testVisible protected ...
pincet's user avatar
  • 839
1 vote
1 answer
40 views

SOQL Lib how to test a sub query

I am trying to test a sub query using SOQL Lib In the docs it says will ignore all filters and relations so how is this possible if I cannot create a relationship? My example is to get all ...
Default 's user avatar
1 vote
0 answers
31 views

Dynamically selecting external credentials with Named Credentials

We have a button that integrates with an external system using Named Credentials. We are using per-user authentication here and every user authenticates themselves with their external system username ...
salesforcets's user avatar
1 vote
0 answers
51 views

Failed to create a Valid JWT token

I am currently working on sending a request to Snowflake using Key Pair Authentication. They have provided me with a private key and a public key, and for testing purposes, I have hardcoded them as ...
Salvation's user avatar
  • 1,147
0 votes
0 answers
36 views

Picklist Labels not translated

I have set up translation on a custom picklist field as shown: The language selected for the Picklist Labels is French, and my User's Language is set to French. According to my understanding, this ...
NickJ's user avatar
  • 660
-2 votes
1 answer
21 views

Error 400 and Error 401

good day to all the users This is my issue, i have 2 environments SO this environments need to send data from sandbox to an app I insert the data with anonymous Window For the 1 environment when I ...
Moon's user avatar
  • 9
0 votes
0 answers
32 views

System.QueryException: List has no rows for assignment to SObject - Apex Class Test Failure

I'm trying to put a deployment into one of our instances and am getting the above error when the Apex Class Test is running. I can't work out for the life of me why it's not working, but suspect that ...
Lyndsay Brown's user avatar
2 votes
4 answers
270 views

Does it ever make sense to create one bulkified and one unbulkified logic route in Apex?

Let's say we are publishing platform events on Salesforce event bus. Some of the trigger points will provide an input of a List of records, some of the trigger points will only provide one record. ...
dbase1's user avatar
  • 176
-1 votes
0 answers
43 views

Facing System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable [duplicate]

I'm having trouble with the API. I tried hitting the endpoint with Postman and the browser, and it worked great. However, when I try hitting the same endpoint from Salesforce using Apex and an HTTP ...
Kujambal R's user avatar
0 votes
0 answers
44 views

Web service callout failed: WebService returned a SOAP Fault: Security requirements are not satisfied

I am trying to integrate Marketing Cloud with Salesforce. //I set the accessToken which I get via the REST Auth service Map<String, String> headerMap = new Map<String, String>(); ...
Endless's user avatar
  • 65
5 votes
1 answer
116 views

Executing SOQL with User Mode and then DML with user Mode causing Exception

I couldn't find if SOQL and DML become interlinked when using WITH USER_MODE with SOQL and DML both in single transaction. I've below sample code to be triggered on a button from an LWC: @AuraEnabled ...
VarunC's user avatar
  • 5,900
0 votes
1 answer
48 views

How to edit Parent Record from Related Record

Objects : Lead(Parent record),LeadClientInsurance__c (Related records) if I change the First_Name__c in LeadClientInsurance__c object I need to change FirstName in Lead Record. Theoretically, ...
Pamoda Wijesinghe's user avatar
0 votes
0 answers
57 views

PersonAccountId inside a test class

Let's say we've got formula field on Account like this IF (IsPersonAccount , CASESAFEID( PersonContactId ) ,"") Is it possible to create somehow an Account record with a particular ...
pincet's user avatar
  • 839
0 votes
1 answer
52 views

Partial commit in before insert trigger - Apex

The Account object has a required field called Test__c to create records in system. I have an apex trigger which updates the field called Copy_Name__c with same details as Account Name. I was trying ...
KSL's user avatar
  • 512
-1 votes
1 answer
44 views

How to make a single connected app created in my dev org to autorize every salesforce user irrespective of the org to my node js application

I've a Node Application where it's functionality is to authorize users using their salesforce credentials and show 360 view of the account information For this I've created a connected app in ...
bnthsrikanth's user avatar
0 votes
0 answers
46 views

I'm getting null value in system debug for nextinjection date while I'm trying to update the date

In the below code I'm getting system debug usernotiif as null. Why? List<Core_MyCarePatientNotificationSetting__c> userNotificationSetting = [Select Id, Core_On__c, Core_AppointmentType__c, ...
Aishwarya's user avatar

1
2 3 4 5
730