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 28390

A trigger is a feature of the Salesforce platform consisting of Apex code that executes before or after DML operations.

3 votes

Error in Trigger

prncList.add(new PartnerNetworkRecordConnection( ConnectionId = cid; LocalRecordId = oppId; SendClosedTasks = true; SendOpenTasks = true …
JaredT's user avatar
  • 880
0 votes

Apex Trigger on Campaign (Create automatic welcome email)

I'm not sure if you are bound by your requirements to do this via trigger, but generally it would be considered best practice to do this through declarative steps: From the setup page, in the sidebar, …
JaredT's user avatar
  • 880
4 votes
1 answer
243 views

Trigger to Populate Lookup via custom field

My trigger passes its test with 100% coverage but when trying to create a new Orders__c I get the following error: Apex trigger PullOrderSiteAccount caused an unexpected exception, contact your administrator … --snip-- Working trigger! …
JaredT's user avatar
  • 880
0 votes
1 answer
131 views

Trigger to lookup Account based on non-unique text field

These records are submitted from an external web form, so I'm not sure how a failed trigger execution would affect the record insertion. … The working trigger that does not account for multiple site codes: trigger PullOrderSiteAccount on Orders__c (before insert) { Set<String> codes = new Set<String>(); for (Orders__c o : trigger.new …
JaredT's user avatar
  • 880
2 votes
1 answer
244 views

Cancel a time-based workflow on Opportunity based on criteria on a related object?

My knowledge of Apex is incredibly limited, but I'm doubtful of finding a declarative fix for this issue without some data restructuring which is less preferable to a simple trigger. … Is a trigger a viable option? …
JaredT's user avatar
  • 880
0 votes
1 answer
1k views

Null Pointer Exception in trigger

I've got a trigger that was working perfectly in my sandbox but once pushed into production we receive: Update_DUA_Last_Activity_Date: execution of AfterInsert caused by: System.NullPointerException … Trigger in question: trigger Update_DUA_Last_Activity_Date on Task (after insert, after update) { //Do not consider tasks with this subject String subjectToExclude = '[Outreach] [Email] [Opened …
JaredT's user avatar
  • 880
2 votes
0 answers
80 views

Before trigger - field not updating as expected

I have another similar trigger on another object in my org that is working just fine so I am at a loss. I do not receive any errors but my assertion fails. … If the trigger is working properly Site_Code__c (lookup) on the Case record should be populated with the id of the account with the matching Site_Code_Id__c (string) Of particular interest, the debug …
JaredT's user avatar
  • 880
0 votes
Accepted

Update related (lookup) record when lead is converted

This in turns uses my existing trigger logic to flag Follow_Up_Date_Changed__c. …
JaredT's user avatar
  • 880
0 votes
2 answers
726 views

Update related (lookup) record when lead is converted

I attempted to use the Lead.IsConverted flag to update a checkbox on a related record in the after update context however it does not appear that converting the lead activates the trigger code: if … Searching google for "Lead trigger activation" is really only giving me advice on creating triggers that automatically convert leads for me which is not what I am looking for. …
JaredT's user avatar
  • 880
1 vote
2 answers
65 views

Update CampaignMemberStatus for a Contact based on Opportunity Closure

Currently I am using a campaign to track the status an offer sent to customers. These were sent to Contacts which are attached to an Account. Here's the tricky part: The Opportunity that is being used …
JaredT's user avatar
  • 880
1 vote

Update CampaignMemberStatus for a Contact based on Opportunity Closure

Aside from a programmatic solution, I am coming up with a declarative solution and I am hoping someone may look through it and point out any glaring errors I may have made: In process builder- Fire …
JaredT's user avatar
  • 880
1 vote
1 answer
105 views

Pick the soonest future date in field from all child records, else null

The Lead trigger works such that when a Lead is updated to have a value in rWeb_Domain__c, the trigger searches for a Company__c with the matching rWeb_Domain__c (only one will exist). … The trigger on Company__c works in conjunction with the Lead trigger. …
JaredT's user avatar
  • 880
0 votes

Trigger that updates a standard field

Your query is too broad. You should include a WHERE clause to specify which records are returned to avoid pulling the data from every existing Account record. In this case it looks like you are only p …
JaredT's user avatar
  • 880
2 votes

Update field datetime to NOW() when chatter added to case

Your workflow rule is applied to the Case object however the case object not what is being updated when you post to chatter. When a chatter post is made it creates a Feed Item object that is related t …
JaredT's user avatar
  • 880
1 vote
2 answers
181 views

Apex class in trigger populates lookup based on string input

I am writing a trigger on my Case object to run (before insert). I am receiving the following error: System.DmlException: Insert failed. … Trigger class public class SiteCoder { public static void run(List<Case> newList) { system.debug('----SITECODER: ' + newList.size() + ' records to run'); Set<String> codes = new …
JaredT's user avatar
  • 880

15 30 50 per page