Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 2602

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.

4 votes

Difference Between Throwing AuraHandledException and Custom Exception in Apex Aura-Enabled M...

One thing to be aware is that if you have a test method that checks the exception's message in an assert, you need to do the following in the code-under-test String myMessage = 'some message'; AuraHan …
fred's user avatar
  • 3,515
4 votes
Accepted

Can you access PermissionSetNames from PermissionSetGroup using APEX?

A handy resource for understanding this is the schema doc in Salesforce Object Reference. You can see Profile and Permission Objects and note that there is a junction record called PermissionSetGroupC …
Arthlete's user avatar
  • 5,039
0 votes

Before Trigger - Validate data prior to assigning?

You have a method called getTitleFromLead and it is passed the Lead record. Based on that method's name, it should take responsibility for deciding/using the existing Lead.Title, if any. Hence, your t …
cropredy's user avatar
  • 73.2k
3 votes
Accepted

Any clean way to delay the execution of a Queuable by 20 seconds in Apex code?

Though not exactly the best multi-tenant option Use a while loop that falls out after 20 elapsed seconds When falls out, do the Queueable enqueue If the triggering transaction is synchronous, the 20 …
cropredy's user avatar
  • 73.2k
0 votes
Accepted

Governor Limits - Concurrent Long-Running Transactions

This is for outbound calls in an Apex transaction that is executing synchronously (like a Visualforce controller, apex web services controller, LWC controller, invocable apex, ...). …
cropredy's user avatar
  • 73.2k
1 vote
Accepted

fflib Unit of Work Mocking with registerNew More Than Once with a Single Record

To supplement the answer by Andrew L and to answer his question in the comments... The lines in the code-under-test uow.registerNew(newMessage); uow.registerRelationship(newMessage, EmailMessage.Paren …
cropredy's user avatar
  • 73.2k
2 votes

How to publish platform event with valid json object inside custom text field?

e", "_EventType":"value" } But if someMessage is also JSON, the double quotes in that JSON need to be escaped with \ by the caller The Salesforce subscriber to the platform event (for example, an Apex
cropredy's user avatar
  • 73.2k
1 vote

Accessing relationship fields in fflib

Selectors are just a mockable reusable wrapper around SOQL that can be independently unit tested. A properly named selector like ContactsSelector.newInstance().selectWithAccountByEmail(emails) tells …
cropredy's user avatar
  • 73.2k
0 votes

Is there a way to catch System.LimitException: Apex heap size too large

In addition to Derek's answer, if the code Is running as a queueable, you can implement Transaction Finalizers that give you some flexibility for recovery or possibly better error notification. These …
cropredy's user avatar
  • 73.2k
3 votes
1 answer
143 views

5 deep Apex soql: System.QueryException: SOQL statements cannot query aggregate relationship...

Given V61 (Summer 24), we get Apex support for 5 deep parent->child relationships. This was previously available only for REST API calls. …
3 votes

5 deep Apex soql: System.QueryException: SOQL statements cannot query aggregate relationship...

Turns out, the feature doesn't work if used as SOQL within a for loop as shown in the OP. This works fine (no SOQL in for loop): Account[] accounts = [SELECT Id, (SELECT Id , (SELECT Id …
cropredy's user avatar
  • 73.2k
2 votes

Issue with testclass

The test class line sendAnEmailSele.sendEmailWithAttachment(ids); references a status method in class sendAnEmailSele but the class is named differently public class sendAnEmailSettle { Some other n …
cropredy's user avatar
  • 73.2k
0 votes

Is Apex Trigger considers two updates on different records from two users into a single tran...

The only way (on the SFDC platform) two different users' "update events" will be considered as a single SFDC transaction is if User[0] publishes a platform event E User[1] publishes a platform event …
cropredy's user avatar
  • 73.2k
0 votes

I am trying to write a trigger on opportunity that will create order and order item on oppor...

Your problem lies here for (Opportunity opp : [SELECT Id, AccountId, ContractId FROM Opportunity WHERE Id IN :opportunityIds]) { Order newOrder = new Order(); newOrder.AccountId = opp.AccountId; …
cropredy's user avatar
  • 73.2k
2 votes

TABSET_LIMIT_EXCEEDED error when assigning permission set to automated process user

You might try this (URL hacking) https://mydomain/lightning/setup/PermSets/page?address=%2Fudd%2FPermissionSet%2FassignPermissionSet.apexp%3FuserId%3D00536000000rMUGAA2 where 00536000000rMUGAA2 happ …
cropredy's user avatar
  • 73.2k

1
2 3 4 5
33
15 30 50 per page