Search Results
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 |
A trigger is a feature of the Salesforce platform consisting of Apex code that executes before or after DML operations.
0
votes
1
answer
74
views
Trigger to update account
The trigger does not work, but there is no error. … Trigger UpdateLEStatus on Case (after insert) {
Set UpdatedAccountIds = new Set();
Id recordTypeId = Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer Save').RecordTypeId;
for ( …
1
vote
Accepted
Trigger to update account
@Vignex provided this answer
Trigger UpdateLEStatus on Case (after insert) { Set<id> UpdatedAccountIds = new Set<id>();
Id recordTypeId =Schema.SObjectType.Case.RecordTypeInfosByName.get('Customer …
1
vote
1
answer
2k
views
Trigger to update account field base on case record type
Trigger UpdateLEStatus on Case (after insert) {
Set<Id> UpdatedCaseIds = new Set<Id>();
for (Case c: Trigger.new) {
if (c.RecordType == 'Customer Save') {
UpdatedCaseIds.add …
1
vote
1
answer
48
views
Should this be a trigger or is there another option I'm missing
I was going to try a custom object with a trigger. Here is what my trigger looks like so far. Any suggestions? … trigger InsertDMA on Lead (before insert, before update) {
for(Lead lead : Trigger.new)
{
string DMA = DMA_Value__c.getInstance(lead.PostalCode).DMA_Value__c;
lead.Market2__c = …
0
votes
3
answers
208
views
VLookup Type of Trigger help
I have a trigger on Leads that is supposed to work like this: When there is a new and or updated value in the PostalCode field. … My trigger is below:
trigger PostalCode_Lookup_LEADS on Lead (before insert,before update) {
Set<String> PostalCode = new Set<String>();
for(Lead l : trigger.new){
if(l.PostalCode ! …
0
votes
2
answers
623
views
Trigger to update leads with information from a custom object like VLookup
I have a trigger that is supposed to work like this: When there is a value in the PostalCode field whether new or updated the trigger looks at the custom object "Name" field which is a list of zipcodes …
0
votes
Accepted
VLookup Type of Trigger help
This answer came from @ToddSprinkel
trigger UpdateDMA on Lead (before insert, before update) {
//get set of Postal Codes from leads to be inserted or updated
Set<String> postalCodes = new Set<String …
1
vote
1
answer
1k
views
Account and Opportunity Relationship Trigger
trigger UpdateDMAAccount on Account (before insert, before update) {
Set<String> BillingPostalCodes = new Set<String>();
for(Account a : trigger.new){
if(a.BillingPostalCode ! …
0
votes
2
answers
691
views
System.NullPointerException: Attempt to de-reference a null object
I keep getting the System.NullPointerException: Attempt to de-reference a null object on my trigger at line 21. I've attempted to add != null to that line and I get an error too. … trigger UpdateDMAAccount on Account (before insert, before update) {
//get set of Postal Codes from leads to be inserted or updated
Set<String> BillingpostalCodes = new Set<String>();
for(Account l : trigger.new …
0
votes
1
answer
34
views
When Activity Inserted by a User that matches User Lookup field on Account, The Date of the ...
I have a trigger where I'm trying to make it work like the following: When a Activity record is inserted by a user that matches the value in a user lookup field on Accounts named "Customer Success Manager … $User.Name
Here is what I have so far:
trigger CELastActivity on Task (after insert) {
datetime myDate = datetime.now();
List<Account> accToUpdate = [SELECT Id,CE_Last_Activity__c FROM Account WHERE …
1
vote
1
answer
287
views
Trigger does not work but there is no error message
I have a trigger that is supposed to work like this "If an account has a case attached to it with a Customer Save record type then the LE_Status__c field on the account is updated to "Red". … Here is the trigger. …
3
votes
1
answer
748
views
DML 10001 Apex Class Error
Sometimes the trigger associated to it is mentioned in the error message. The error messages I receive are listed below. These classes used to run just fine. I'm not sure why they are failing now. … IsTriggerContext;}
}
}
This is the trigger:
// Sets the Account Owner based on the first SLS #
trigger AccountOwner on Account (before insert, before update) {
try {
// Call the security object …
0
votes
1
answer
503
views
Can't figure out what is causing the dereference null object error? [duplicate]
FIRST ATTEMPT
trigger UpdateDMAAccount on Account (before insert, before update) {
//get set of Postal Codes from leads to be inserted or updated
Set<String> BillingpostalCodes = new Set<String>();
for … validBillingPostalCode.containsKey(l.BillingPostalCode)){
//blank value if new PostalCode does not match a record in the Map
l.DMA__c = NULL;
}
}
}
}
SECOND ATTEMPT
trigger UpdateDMAAccount …