Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [after-trigger]

After triggers are used to access field values that are set by the system (such as a record's Id or LastModifiedDate field), and to affect changes in other records.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Error while updating Lookup field on Case recprd after insert from Web-to-Case form

I'm trying to update the lookup field (Account ID) using the trigger after inserting the Case record by using the Web-to-Case form. But it is throwing the error "FATAL_ERROR|System.FinalException:...
RKCY's user avatar
  • 323
1 vote
0 answers
39 views

Can we override the System defined Exception message using the Custom Exception Handling?

I have tried to handle the system defined Exception using the Custom Exception in Apex but only the message part gets overriden. Is there any chance that we can override the entire system defined ...
Sai's user avatar
  • 11
1 vote
2 answers
62 views

Nested for loop causing error "System.LimitException: Too many DML rows: 10001"

I have a trigger handler class afterInsert() with following code: public void afterInsert() { if(Handlerclass.isafterInsert){ Handlerclass.isafterInsert = false; ...
sfdcDev's user avatar
  • 67
2 votes
1 answer
61 views

Debug Log shows Flows executing in a different order to Flow Trigger Explorer

Just wondering if someone can help me to understand what I'm seeing in our org. I'm trying to document the order in which our automation runs when a Lead is created. My problem is that I'm seeing ...
Matt's user avatar
  • 61
0 votes
1 answer
42 views

Why we need before update for roll up summary calculation in apex trigger?

My trigger scenario: Once an account will update then that Account will update with the total amount from All Opportunities on Account level. Account field name would be Total Opportunity Amount. ...
Sridhar's user avatar
  • 49
-1 votes
1 answer
51 views

Why we need to use before delete event instead of after delete in apex trigger

For example: My trigger scenario: when account record is deleted then contact record should also be deleted. My Implementation: when account record is deleted then contact record should also be ...
Sridhar's user avatar
  • 49
0 votes
0 answers
30 views

Error when running a bulk update to trigger a trigger: Required fields are missing: [Status]: [Status] (LabsActionPlans): []

I have created a trigger on the Task object which executes afterUpdate, afterInsert and beforeDelete. This trigger will get the relevant Opportunity using the WhatId field on the task, run some logic, ...
ViqMontana's user avatar
0 votes
0 answers
64 views

Best practice for designing flows that require recursion and same-record updates

I'd like some inputs on the current best practice for building Flow automation which a) needs to update the same triggering record but only after an action (like sending an email) that isn't available ...
JustinF's user avatar
  • 485
0 votes
0 answers
45 views

Several updates on Case record withing short period of time causing "duplicate value found: <unknown>"

I have pretty complex process starting with scheduled Batch Apex, calling my Mulesoft endpoint to retrieve some data and save it on Case record: Batch apex request from Salesforce to Mule is ...
Michal Piatek's user avatar
0 votes
0 answers
21 views

Manager Id is not updating whenver the user is deactivated using apex trigger [duplicate]

My implementation: trigger userTrigger on User (after update) { Switch on Trigger.OperationType { when AFTER_UPDATE { userHandler.checkUser(Trigger....
Sridhar's user avatar
  • 49
0 votes
0 answers
64 views

ManagerId is not assigning for inactive user using apex trigger?

My Trigger Scenario: ๐‘พ๐’‰๐’†๐’๐’†๐’—๐’†๐’“ ๐’‚ ๐’–๐’”๐’†๐’“ ๐’Š๐’” ๐’…๐’†๐’‚๐’„๐’•๐’Š๐’—๐’‚๐’•๐’†๐’… ๐’‚๐’”๐’”๐’Š๐’ˆ๐’ ๐’‚๐’๐’ ๐’‰๐’Š๐’”/๐’‰๐’†๐’“ ๐’‚๐’„๐’„๐’๐’–๐’๐’•๐’” ๐’‚๐’๐’… ๐’„๐’๐’๐’•๐’‚๐’„๐’• ๐’•๐’ ๐’•๐’‰๐’† ๐’“๐’†๐’”๐’‘๐’†๐’„๐’•๐’Š๐’—๐’† ๐’–๐’”๐’†๐’“'๐’” ๐’Ž๐’‚๏ฟฝ...
Sridhar's user avatar
  • 49
0 votes
1 answer
58 views

Error: Apex Trigger - Read only record (Opportunity/Quote)

I'm taking my first steps in Apex. I'm trying to make a trigger with bulk that has the following requirements: The opportunity should be advanced to the 'Value Proposition' as soon as it has your ...
Aparicio Jr's user avatar
-1 votes
2 answers
56 views

I'm getting error like Invalid id value for this SObject type in after update call using apex trigger

My Trigger Scenario: write an apex trigger to update the related contacts with the latest country field value whenever it changes on the parent account record. My Implementation: public static void ...
Sridhar's user avatar
  • 49
0 votes
1 answer
41 views

For update operation,average amount is not updating in apex trigger

Trigger scenario: ๐–๐ซ๐ข๐ญ๐ž ๐š๐ง ๐€๐ฉ๐ž๐ฑ ๐ญ๐ซ๐ข๐ ๐ ๐ž๐ซ ๐ญ๐ก๐š๐ญ ๐œ๐š๐ฅ๐œ๐ฎ๐ฅ๐š๐ญ๐ž๐ฌ ๐ญ๐ก๐ž ๐š๐ฏ๐ž๐ซ๐š๐ ๐ž ๐จ๐Ÿ ๐š๐ฅ๐ฅ ๐ซ๐ž๐ฅ๐š๐ญ๐ž๐ ๐Ž๐ฉ๐ฉ๐จ๐ซ๐ญ๐ฎ๐ง๐ข๐ญ๐ฒ ๐€๐ฆ๐จ๐ฎ๐ง๐ญ๐ฌ ๐š๐ง๐ ๐ฎ๐ฉ๐๐š๐ญ๐ž๐ฌ ๐š ๏ฟฝ...
Sridhar's user avatar
  • 49
0 votes
1 answer
39 views

What is the best approach for inserting large data set in Apex trigger?

my trigger scenario: ๐–๐ซ๐ข๐ญ๐ž ๐š๐ง ๐€๐ฉ๐ž๐ฑ ๐ญ๐ซ๐ข๐ ๐ ๐ž๐ซ ๐ญ๐ก๐š๐ญ ๐œ๐š๐ฅ๐œ๐ฎ๐ฅ๐š๐ญ๐ž๐ฌ ๐ญ๐ก๐ž ๐š๐ฏ๐ž๐ซ๐š๐ ๐ž ๐จ๐Ÿ ๐š๐ฅ๐ฅ ๐ซ๐ž๐ฅ๐š๐ญ๐ž๐ ๐Ž๐ฉ๐ฉ๐จ๐ซ๐ญ๐ฎ๐ง๐ข๐ญ๐ฒ ๐€๐ฆ๐จ๐ฎ๐ง๐ญ๐ฌ ๐š๐ง๐ ๐ฎ๐ฉ๐๐š๐ญ๐ž๐ฌ ๏ฟฝ...
Sridhar's user avatar
  • 49
0 votes
0 answers
49 views

While inserting a new lead update trigger is executed

Created a new trigger with below code : trigger LeadSourceUpdate on Lead (before insert,before update,after update) { for(Lead l : Trigger.new){ if(Trigger.isBefore){ if(...
Sai Bhargav's user avatar
0 votes
1 answer
52 views

Trigger Error Handling

I have an after update trigger on Account which updates the child contacts Industry field. Sample Code: Trigger accountTrigger on Account(After Update){ Map<Id, Account> acMap = new Map<...
Rachel's user avatar
  • 31
-1 votes
2 answers
60 views

Preventing Trigger Recursion codeLive Questions

A minor questions from the Preventing Trigger Recursion CodeLive. One main purpose of this video is to create a trigger that will work on bulk DML. The static boolean doesn't work because only the ...
louis's user avatar
  • 81
0 votes
1 answer
94 views

Apex Trigger rollback DML operation if error occurs in bulk insert

So I'm using the XL-Connector add-on to insert some 30k records into the database. The records are inserted in batches of 200. Based on some complex logic in the insert trigger, I'm determining if ...
Alin Paraschiv's user avatar
0 votes
1 answer
65 views

there must be only one primary contact on account by utilising isprimary checkbox

stuck in here What if someone uses dataloader and make 2 contacts for same account as primary, then my code is not working public class Contactispr { public static void Conta(List<Contact> ...
manutomar46's user avatar
2 votes
1 answer
431 views

Create ContentDocumentLink after insert ContentDocument error

I have pretty simple requirement but I am facing error and I can't understand what is going wrong. I need to add ContentDocumentLink to add file to CollaborationGroup after insert with C permission. I ...
Maciej's user avatar
  • 45
0 votes
2 answers
44 views

AfterInsert caused by: System.FinalException: Record is read-only

I want to update a record that has recently been created. Trigger: trigger TTCaseTrigger on Custom_Case__c (after insert) { if(Trigger.isInsert && Trigger.isAfter){ if(...
Speenzar XaXai's user avatar
-1 votes
2 answers
37 views

I'm not able to Insert New releted contact with with 'Primary Contact' checkbox checked. help me out there

trigger PrimaryContactTrigger on Contact (before delete, before update, before insert) { if (Trigger.isBefore) { if (Trigger.isDelete) { for (Contact con : Trigger.old) { ...
Shrikant Devkhile's user avatar
0 votes
2 answers
67 views

How to update values in related object fields after record is deleted

I have two objects ObjA__c and ObjB__c which are in many-many relation. Now there is a field on ObjA__c which is sum__c and this value is a sum of rank__c field on ObjB__c. For ex: If ObjA__c has 3 ...
sfdcTod's user avatar
-2 votes
1 answer
543 views

Field is not writeable: Account.ShippingAddress

I was coding a trigger for automatically fill up shipping address when a account is created with billing address. code down below trigger BillingAdd on Account (before insert) { List<Account> ...
Impana 's user avatar
1 vote
1 answer
124 views

How to rearrange the priorities of the records using Apex?

I have a requirement to auto update priorities based on the input from the user. On Object Requests__c I have 2 fields Priority__c(Number) and Board__c (Picklist values A, B, C and D). Suppose if I ...
Praveen's user avatar
  • 15
0 votes
0 answers
50 views

Unable to fetch the most up-to-date value from Trigger

I've encountered an issue with retrieving the latest BillingLatitude value through a trigger. It consistently retrieves the old value in an 'After Update' Trigger, even when the entire address is ...
MnZ's user avatar
  • 3,170
0 votes
1 answer
101 views

How can I convert normal triggerHandler Method to Future method?

Im learning about Future methods so wanted to covert my triggerHandler method to Future method...where Im trying to insert contact on every user insert. but im getting an issue called "Future ...
Sajid's user avatar
  • 13
-2 votes
3 answers
82 views

caused by: System.SObjectException: Opportunity.AccountId does not belong to SObject type AggregateResult

I simply wanted to update inserted line item count on Account field Name Line_Item_Counts but ended up with this issue. code is errorless but at the UI I am unable to insert Quoteline Items Here is ...
Sajid's user avatar
  • 13
0 votes
0 answers
119 views

Question on beforeUpdate or afterUpdate trigger in Salesforce

I have some doubts on whether I should be using a beforeUpdate or an afterTrigger for the scenario enlisted below. Any pointers would be very helpful. Thanks in advance. I have a custom object ABC ...
Bharath Sridhar's user avatar
0 votes
0 answers
24 views

Unable to get full code coverage for a SF trigger after update [duplicate]

I have a simple Apex trigger, written for an object called Application__c, and it fires after the "Shipping_City__c" field changes: 1.trigger MyTrigger on Application__c (after update) { ...
Rose Mirzaei's user avatar
-2 votes
1 answer
63 views

Need to bypass this validation Rule which is causing while creating the b2b records, for the live chat, Can any one please help me how should i bypass

FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, must populate atleast contactย : tรฉlรฉphone / e-mail.: [] Class....
Khulas Khulas's user avatar
2 votes
1 answer
144 views

Trigger IF statement will not fire

I have a trigger that has an If statement in it, that if statement should pick up any new lead assigned to the Pre Qual queue. This Queue is set when I manually create a new lead and click the use ...
Sgrove 's user avatar
0 votes
1 answer
168 views

Querying History Object in update trigger, not showing the new History Object record?

I have a custom object (TestObject1__c) wherein I am tracking some field changes. I also have related list under this object (TestObject1__History). The problem is the trigger I created isn't querying ...
ratRiot01's user avatar
-1 votes
2 answers
620 views

List index out of bounds: 0 in IF condition

There is an error on line 36: List index out of bounds: 0 Why am I getting this error when I'm not actually using the value, instead I'm just checking if it's null?
JRachelle's user avatar
1 vote
1 answer
48 views

Updated triggering record with value from related record

I have a Flow that gets triggered when a User Lookup field (Support Specialist User) is changed/set. In an After-Update Record element two fields on the same record should be updated with the user.id ...
wp78de's user avatar
  • 191
0 votes
1 answer
277 views

How to get the Lead Record using ConvertedContactId field in after Insert Trigger on Contact?

Scenario: I have a Lead record and it's single child record. On this child record of Lead I have a look up of Contact and Account also. Whenever a Lead is converted to Account and Contact, I want to ...
Prashant Kumbhar's user avatar
0 votes
0 answers
91 views

EmailMessage Trigger causes missing EmailStatus records

An apparent problem we have found using an Apex Trigger on the standard 'EmailMessage' object is as follows: The trigger handles the 'after insert' event and when an email is sent (e.g. from an Apex ...
John Lewis's user avatar
0 votes
2 answers
78 views

Adding a local variable into a trigger gives error

I'm working on creating a trigger that uses one of the methods from the URL class and has a local variable. When I don't use a local variable it works but when I try to introduce a string it give me ...
James's user avatar
  • 337
0 votes
1 answer
152 views

when converting lead i want to check lead email is equal to existing account email if it is then i want to create opportunity under existing account

i have 2 methods in trigger ,one is if the lead have initial and final fields values then i want to create opportunity line items and subscription and this is working fine. second is when converting ...
Deena Vicky's user avatar
0 votes
1 answer
236 views

TriggerHandler Question about New/ Old Values

I am trying to compare the 'old' value with the 'new' value on a record after it is updated using a TriggerHandler. Below is my code for the TriggerHandler class and also the Trigger. Specifically, I ...
sp2's user avatar
  • 77
0 votes
1 answer
154 views

Primary user Checkbox ticked for Contact with highest Commission

I'm new to Salesforce and Apex. I need help setting a trigger which checks Contacts under a specific Account. The Contact with the highest Total Commission value is marked as Primary user by ticking ...
Rad's user avatar
  • 3
1 vote
1 answer
563 views

Apex Trigger that whenever account owner gets changed, send an email to previous account owner

Hello Everyone I wanted to write trigger that whenever account owner gets changed, send an email to previous account owner. and I wrote this trigger but working. trigger SendEmail on Account (after ...
Sajid's user avatar
  • 13
0 votes
0 answers
34 views

Custom code not implementing functionality

I am writing a trigger on Account when Account Active field is updated from โ€˜Yesโ€™ to โ€˜Noโ€™ then check all opportunities associated with the account. Update all Opportunities Stage to close lost if ...
sourav guha's user avatar
0 votes
1 answer
175 views

After delete trigger is not firing< but code in anonymous works properly

I have Active_Contacts__c Decimal field in Account and Active__c checkbox in Contact, also created ContactTrigger and ContactTrigger handler. I have already created logic for after update event and it ...
RandomNickname23's user avatar
-1 votes
1 answer
329 views

SonKitapTarihi: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id no

fail is:SonKitapTarihi: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Trigger....
Fatih çelik's user avatar
0 votes
1 answer
531 views

Trigger to update field on master object based on detail object field

I'm working with Opportunity object and OpportunityDetails object that have a master-detail relationship with one another. The master's api name is Opportunity and the detail's api name is ...
Tency Serah's user avatar
-1 votes
1 answer
63 views

How to convert trigger into handler of after insert, after update, before delete

trigger DPRLineItemsTrigger on DPR_Line_Items__c (after insert, after update, before delete) { if(Trigger.isDelete && Trigger.isBefore) {Map<String, DPR_Line_Items__c> ...
apz's user avatar
  • 5
0 votes
2 answers
342 views

Do I need to merge assignments in a flow on the same record or not?

I am running an after record flow Within the flow, both 'Update record' update the same record. My question: should I 'merge' both updates to reduce DML ? or the flow engine does that for me? Is it ...
Saariko's user avatar
  • 5,610
-1 votes
1 answer
251 views

How can I create custom addError message in ContentVersion trigger?

I have a trigger that will prevent the user to upload file but the error message in ContentVersion is being overridden by Lightning. How can I create a custom error message? trigger CDTrigger on ...
ratRiot01's user avatar

1
2 3 4 5
โ€ฆ
9