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 72832

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 vote

Need to create a knowledge user in test class

testUser.UserPermissionsKnowledgeUser = true; Otherwise, the required fields when creating a user in apex are the following and will also need to be set LastName TimeZoneSidKey LocaleSidKey EmailEncodingKey …
Kris Goncalves's user avatar
2 votes
Accepted

How to add a field's value via apex code under the existing Account?

I'd suggest looking at trailheads for a good tour on basics in apex and SOQL queries. …
Kris Goncalves's user avatar
0 votes

Link incoming cases to new / existing accounts through apex

You should be able to check for this when you're building your map. I'd add any key that is a duplicate to a set and then just iterate again over the keyset to remove those values so later on you can …
Kris Goncalves's user avatar
1 vote

Programmatic (Apex code) approach advantages

The Choose the Right Automation Tool trailhead also has this blurb about when to use Apex Use Apex when you need more functionality than is available in Flow Builder. … Build the more complex functionality as invocable Apex methods. Then call the resulting Apex as an Apex action in the process or as an Apex action element in the flow. …
Kris Goncalves's user avatar
2 votes

After creating user from apex, user is not getting email for creating new password

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Database_EmailHeader.htm Based on the above, you'd replace your insert call with a database call using the inform …
Kris Goncalves's user avatar
1 vote

EmailMessage Object : EmailTemplateId is null

Otherwise, it seems it only works within the Lightning Experience which means emails sent from apex don't get stamped. … I tested in my org as well as follows: Using apex to send an email with a email template = did not set the EmailTemplateId field on the EmailMessage record. …
Kris Goncalves's user avatar
2 votes

Regarding moving createtestdata method to @testsetup

You would need to re-query your test data as opposed to just accessing the variables from the method as you don't have access to them from TestSetup. If you see the example linked below for TestSetup, …
Kris Goncalves's user avatar
1 vote

How to create an apex class to update a field for a specific record id?

https://help.salesforce.com/articleView?id=process_action_apex.htm&type=5 You need to annotate the method with @InvocableMethod to call it from process builder. In the method, name a variable as a pa …
Kris Goncalves's user avatar
0 votes
Accepted

Integration and Current Apex Jobs - User record

contain all the various things you should check The suggested approach to deactivate an administrator account I'd highlight querying all dashboards with the user as the running user and any scheduled apex
Kris Goncalves's user avatar
1 vote
Accepted

Preventing duplicate records on the same/between date interval. Error: Schema.SObjectField f...

Taking a step back...You shouldn't be doing any real logic in the trigger. Imagine if you have to add functionality to this object and you risk breaking everything in that object because you put every …
Kris Goncalves's user avatar
1 vote

How to run this Contact Trigger only if Task is Inserted or Update

Regardless, you could just create an apex trigger on task and then check the sObject of the whoID. …
Kris Goncalves's user avatar
2 votes
Accepted

How to handle Url when there is no Record Id return?

https://help.salesforce.com/articleView?type=1&mode=1&id=000328824 The issue is that you're expecting 1 record by querying into a single sObject and this will throw an error if no rows are returned. …
Kris Goncalves's user avatar
1 vote
Accepted

Variable does not exist: Contact_Relation__c when Using trigger.oldmap

I would pass the oldmap as a parameter as well. You're currently only passing the new trigger variable. I'd also look at your logic, you're currently comparing the old value even if the trigger contex …
Kris Goncalves's user avatar
4 votes

How to convert 08:00:00.000Z to 08:00 AM and 18:00:00.000Z to 06:00 PM in salesforce apex?

This is the example straight from the documentation that you can run in anonymous apex to confirm it displays how you'd like. …
Kris Goncalves's user avatar
1 vote

Using List Collection SOQL Value "variable does not exist"

It looks like you expect one record in your query, but you're storing it in a list? https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_list.htm Since it's …
Kris Goncalves's user avatar

1
2 3 4 5
10
15 30 50 per page