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
-2 votes
2 answers
43 views

After Insert and After update found exception help me [closed]

Help me to solve this problem: When inserting a new record, title field must be updated to 'Demo for After insert'. When updating the record, the title must be updated into 'Demo for After Update'. ...
user avatar
0 votes
1 answer
17 views

Pass record Id to an auto launched flow from an after delete trigger

I have a requirement to update a field on a parent record after a child record is deleted. I would like to call an auto launch flow from an after delete trigger to handle the logic, however I'm having ...
user avatar
  • 1
0 votes
0 answers
25 views

Lock an approval process for a particular profiles users and system admin

I have created an approval process and provided field update such that each time I submit a record for approval,the pick list value changes to 'Approval Pending'. On continuation to this, I have added ...
user avatar
  • 47
1 vote
1 answer
28 views

Record Triggered Flow trying to create duplicate records

I have a record triggered flow that needs to create related records if they do not already exist. However, once the record is created, if other records in the transaction would have triggered a create ...
user avatar
0 votes
1 answer
60 views

trigger to count the number of related records

I have a requirement to count the number of candidates looking upto a Test Center object. The field "No of Candidates" on the Test Center object should calculate the number of candidates ...
user avatar
-4 votes
1 answer
28 views

trigger to update contact when account is updated [closed]

trigger AcccAddrUpdate on Account (after update) { if (trigger.isafter && trigger.isUpdate){ List<contact> conNList = new List<contact>(); for(Account accRecn :...
user avatar
0 votes
0 answers
23 views

Need help with code coverage for trigger and for loop [duplicate]

I'm new to Salesforce unit tests and am stuck on how to get coverage for the for loop below. The trigger inserts requirements based on their contact record type and which department they are in. I'd ...
user avatar
  • 1
0 votes
1 answer
33 views

Directly update triggering record in after save flow

I have a after saving flow and I am using update triggering record directly option to update the fields. Is it good to have this option for after save flow for every decision like below? Because we ...
user avatar
0 votes
1 answer
36 views

Triggers on contact to update decsiption field of its parent account

i am new to sales-force triggers i need help for writing this trigger i tried to wrote but whenever i am inserting new contact for the same parent the account descriptions is getting over written with ...
user avatar
1 vote
2 answers
37 views

I am trying to split logic from Trigger to handler class with "Method does not exist or incorrect signature: void Error

I am a starting SF developer and having issues with handler class. This is my original trigger: trigger OpportunityTrigger on Opportunity (after insert, after update, after delete) { Map<Id,...
user avatar
  • 13
0 votes
1 answer
31 views

Chatter feed auto refresh

So i have used a trigger to delete the Chatter Post but unless the chatter feed is refreshed the latest update will not be visible. Is there any way to refresh the chatter feed when the record is ...
user avatar
0 votes
1 answer
43 views

Need to insert New Event Date and time in Account Field (Event Date Time (manually created)) through Apex Class/Trigger [closed]

I am trying to insert New Event Start date/time and End date/time in Account object field (Event Date Time). Please help me to trigger code. Once New Event created, the Start Date/Time & End date/...
user avatar
0 votes
1 answer
29 views

Issue while inserting new Opportunity Product records on after insert trigger

Here is the scenario: I have a Bundle product which when added to the opportunity should add related products in that Bundle. I have written trigger on after insert but instead of adding related ...
user avatar
  • 111
0 votes
0 answers
60 views

After Flow Validation Error

Background on our Salesforce org: Validation rules have been created in order to prevent Sales users from modifying Account & Contact Owners An After Flow has been created that in the case ...
user avatar
0 votes
1 answer
18 views

Converting Lead to Contact Related Record Files are not attaching to Contact record

While I'm Converting Lead to Contact, Related Lead Record Files are not attaching/updating to a Contact record. Only record data is updating to Contact but not files, please help me with this public ...
user avatar
1 vote
1 answer
253 views

Method does not exist or incorrect signature: void valueOf(Object) from the type Decimal

I am getting errors when storing my aggregate result value in the currency field. I have tried to look into a similar error but not getting anything. Below is the logic which I am trying to implement. ...
user avatar
  • 107
0 votes
1 answer
68 views

Iterate over map for assignment avoiding nested loop in Salesforce

I want iterate over map in such a way that it can assign a accuserlookup__c field from account to it's relevant contact conUserlookup__c field without nested for loop and update contact in the end. ...
user avatar
3 votes
1 answer
191 views

Obtaining Prior Record Values Using Asynchronous Flows

I created a flow that launched asynchronously and leverage the prior record values. {!$Record__Prior} The flow was unable to launch because I was referencing the prior record. So what I did was remove ...
user avatar
-1 votes
1 answer
212 views

How could I pass IDs in before insert trigger?

I need ID from records from custom objects When I try before insert, I can't pass IDs (because newMap is null) and when I try after insert I also have an error "record is read-only" I can do ...
user avatar
0 votes
0 answers
50 views

How to create a new record in a custom object whenever a new event is created in calendar?

I am totally new in writing triggers. In my org there is custom object called meeting where they track all the meeting details with contacts (like meeting time, meeting place, who all are attending ...
user avatar
-1 votes
1 answer
42 views

Trigger to fetch unrelated object record [duplicate]

How to update unrelated object feild when opportunity is created with related account which has same name email phone as in lead
user avatar
0 votes
1 answer
34 views

Alter code to be reusable across objects?

I'm working on this https://medium.com/salesforce-zolo/build-your-own-teams-feature-for-custom-objects-in-salesforce-963ed3630f4 but trying to instead alter it into a single helper class that creates ...
user avatar
  • 3
1 vote
1 answer
44 views

Internal salesforce.com error while trying to access trigger.new context variable

I have created a trigger on the LogoutEventStream object, to perform the user logout-related functionality. When the user tries to log out from the application by clicking on the logout button, it is ...
user avatar
  • 11
0 votes
1 answer
52 views

How can I use an Apex Trigger to start an Autolaunched Flow and pass in a collection of new records?

I have an object that receives frequent imports. We tried a record-triggered flow to handle after-save processing of related records, but we're hitting limits with import files >100 records. Record-...
user avatar
0 votes
0 answers
53 views

Add Lead related products to opportunity related products after converting

Identifying if the lead is converted Which opportunity it is getting converted to. --> ConvertedOpportunityId Query on all the products added at lead related list. Create same products at ...
user avatar
0 votes
1 answer
119 views

After Insert trigger creating duplicate records

I have a requirement to create a new email_capture__c record when task record is created. Before inserting this record, the requirement is to check if the task description value is matching with ...
user avatar
0 votes
1 answer
348 views

Write a trigger on Contact and fill its Mailing Address with its Account's Shipping Address

I am trying to write an trigger for when a contact get inserted or updated its mailing address so i want to copy this mailing address to its associated account's shipping address. I am getting this ...
user avatar
  • 11
0 votes
1 answer
59 views

How to create a record in link with other object

I am new to apex triggers and starting new with trailhead i have this task to do : Implement database trigger for Order object ● Trigger should create an invoice record for the order record always ...
user avatar
1 vote
2 answers
71 views

Apex trigger running recursively

I have a scenario where i have a checkbox field on Account object "test_check__c" and this checkbox field is applicable only for child accounts and not for the parent. Scenario is : - Parent ...
user avatar
  • 1,528
1 vote
1 answer
68 views

How to update records which also are updated by by batch process

We currently have a batchprocess running from a managed package which runs every day for almost the whole day to update records of an object. When a user tries to do an update on this object we have a ...
user avatar
  • 2,092
0 votes
1 answer
56 views

Can a Trigger Handler be used on 2 separate Triggers, so that if 1 runs the other doesn't and vice versa

Can a Trigger Handler be used on 2 separate Triggers, so that if 1 trigger processing the data onto another object, and then the other trigger is prevented by the handler, and vice versa when the data ...
user avatar
0 votes
1 answer
43 views

Before Delete Trigger : Need to compare User with the Owner [closed]

i want to add in my trigger before delete to compare if the owner of a form is the user , if it true then i can delete but in the object form i don't have an object that refer to the user , how can i ...
user avatar
0 votes
1 answer
32 views

Is the rule of 'triggers for one object not creating or editing records of a different object' a good idea in a managed package?

Context: Working with Multiple 2GP Packages in a Single Namespace. It's a big package(s). OEM environment so this is the core application used by clients on the salesforce platform and takes ...
user avatar
0 votes
1 answer
56 views

Unable to update the text area field from apex

we have this code in catch block, the requirement is to capture the error before throwing the error to lwc component in a field. Repair_Repaired_Vehicle_Cost__c cost = new ...
user avatar
0 votes
2 answers
51 views

two triggers on object

we have 2 objects Account and Dsignation parent object:Account Child object: Designation Relationship :Lookup(Field name "Account__C" on Designation object) If an Account has Designation ...
user avatar
-4 votes
1 answer
39 views

In Triggers Getting Error Invalid loop variable type

Iam trying to update the CTSRecrutingApp__Warranty__c field in CTSRecrutingApp__Bill__c custom object depending on other custom object field CTSRecrutingApp__Warranty__c in ...
user avatar
-3 votes
1 answer
269 views

Test class trigger.NewMap trigger.oldMap on opportunity [duplicate]

I need to write a test class on my OpportunityTriggerHandler and I'm having some difficulties to define how to construct the logic & scenarios in my test to test and the data to build in my test ...
user avatar
  • 1
-2 votes
1 answer
33 views

Cross object filed Update trigger

I have two custom objects booking__c and car__c I am trying to write a trigger when On Booking, selected car availability should change from true to false. (booking__c and car__c have lookup ...
user avatar
0 votes
0 answers
94 views

Why does deleting one Child record cause an update trigger to fire on another child object?

We have a custom before update trigger that fires on our OpportunityLineItem object whenever the record is updated, and it works fine. However, we have a separate after delete trigger for the same ...
user avatar
0 votes
1 answer
107 views

Trigger - Insert Case and update relationship on Parent

I am creating a case record in parent obj after trigger. There is a lookup field on parent object which is related to Case object and I want to update this. Field Name: RelationshipToCase Field Type: ...
user avatar
  • 15
0 votes
1 answer
130 views

Trigger to update a Lookup Record when status field is updated

I am trying to solve a simple problem. I have an object Service_Expansion_Tracker__C, there is a lookup field NHC_Tracker__c on the object (The relation between NHC tracker and Service Expansion ...
user avatar
0 votes
1 answer
619 views

Trigger - Update minimum and maximum salary on contacts using Trigger

Requirement: I want to update minimum and maximum salary of Contacts using trigger. For that, I have created custom fields on Account object named as MaxSalary and MinSalary. I am like to know, My ...
user avatar
0 votes
2 answers
175 views

Question for confirmation: Callout from Trigger using Platform Events

After a record is updated in Salesforce, i need to perform a callout to synchronize data to an External System. Ideally, i would like to do this kind of synchronously, however it doesn't seem to be ...
user avatar
0 votes
1 answer
186 views

When file is uploaded need to send an email with attachment with file format

I have a task that when i upload a file with excel or pdf or any format at that time it have to send an email with attachment with the file type which i upload . Below is my code:- trigger ...
user avatar
0 votes
1 answer
163 views

How To Write Test Code Account Trigger Handler After Update

I wrote a trigger handler class on account to send an email if the code red field changes. If the code red field changes from true to false the email is sent and it blanks out certain fields on ...
user avatar
-2 votes
2 answers
42 views

Datetime calculation not working as expected on after update trigger but no errors

I am trying to do some calculation based off datetime fields. I dont get any errors, but for some reason they don't work. Case caseRecord = [SELECT Id, Next_Call_Date__c, Last_Call_Timestamp__c, ...
user avatar
  • 501
0 votes
1 answer
48 views

No Logic in Trigger Mike Wheeler vs. Trailhead

So I am using two resources for working with triggers. One is MWM Developer I videos and the other is Trailhead. I have noticed that in MWM they insist that all logic should be in a Trigger Handler ...
user avatar
-1 votes
1 answer
544 views

Update failed. First exception on row 0 with id 0015g00000SAP87AAH; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, duplicate account not allowed: []

Create field called “Count of Contacts” on Account Object. When we add the Contacts for that Account then count will populate in the field on Account details page. When we delete the Contacts for that ...
user avatar
0 votes
1 answer
108 views

Account TO Contact After Update

I tried Account To contact trigger in which i wrote a code to change phone of contact as per account Phone Let me know if its comes in best practice. if not so how to do it with best practice.. ...
user avatar
0 votes
1 answer
222 views

Record hyperlink inside trigger

I created a record hyperlink and sending it over an email but when I click the link the record id in the URL is changing like this '%7Ba006F00003dLUwDQAW%7D' trigger UserReqNotification on ...
user avatar
  • 107

1
2 3 4 5
8