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 [trigger]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 views

Feasibility and what tools should be put in place for this functionality?

Good morning, I have been asked for a new feature but I am not sure of its feasibility We have a call center that uses Aircall (In Lightning Experience) I was asked that when a colleague picks up a ...
arnaud's user avatar
  • 96
1 vote
1 answer
40 views

Create Trigger to conditionally before inserting new records, criteria below

I am trying create a Trigger in my Salesforce Org, where I want to create a new record in an object only if no records already exists, and if records already exist then the end date should be null. If ...
Madan Nanoopillai's user avatar
2 votes
0 answers
49 views

I'm not able to catch null pointer exception using error log object

I have created one custom object called ErrorLog__c and I have created some custom fields like: Error_RecordIds__c Error_Message__c Error_Stack_Trace__c JobId__c My trigger code: trigger ...
Sridhar's user avatar
  • 49
1 vote
1 answer
52 views

No way to notify a user when they are added as a case team member?

I am blown away that this seemingly simple functionality is missing - There is no simple way in setup to send an email to a member after you add them to a case team. I was resigned to doing a more ...
Chris's user avatar
  • 61
0 votes
2 answers
37 views

How to exclude a related object type from validation rule

I have an Object called 'Program' which is creating/inserting a Task record. On the Task I have a validation rule for a specific profile which is blocking the creation of Program indirectly through a ...
Niklaus's user avatar
0 votes
0 answers
38 views

Donorbox and Salesforce Integration

I am writing to request guidance on exporting data from DonorBox to Salesforce Sandbox. I found the source of the errors are "With a lot of triggers and classes within NPSP, you can 'turn off' or ...
Smita Ugale's user avatar
0 votes
0 answers
29 views

My Opportunity Test Class is not calling the Opportunity Trigger that executes Opportunity Trigger Handler Class with Helper Class

I implemented the Trigger Framework. This is my Opportunity Trigger trigger OpportunityTrigger on Opportunity (before update, after update, before delete{ new OpportunityTriggerHandler().run(); } ...
raghavendra yadavalli's user avatar
0 votes
1 answer
37 views

FIELD_INTEGRITY_EXCEPTION - Price book entry is inactive

I have a custom lightning component button with trigger on the Opportunity object, which clones the existing Opportunity and associated Quote record. At the moment, we cannot clone Opportunities where ...
Sophia's user avatar
  • 31
0 votes
1 answer
47 views

Getting error while implementing the trigger dispatcher architecture

when I am writing implementing class, I am getting the error Error: Compile Error: Class signingFormHandler must implement the method: void ITriggerHandler.initialize(String) at line 1 column 14 ...
Kumar's user avatar
  • 13
2 votes
1 answer
33 views

How does `EventBus.TriggerContextsetResumeCheckpoint()` work?

I'm currently looking at the "Apply Best Practices for Writing Platform Event Triggers" Trailhead where EventBus.TriggerContext.setResumeCheckpoint() is apparently used to set "...
Brian Kessler's user avatar
0 votes
1 answer
30 views

Advice on approach to powering journeys in SFMC

Full disclosure, I am a Marketer who has mainly been working with SFMC but now have our data in Salesforce and are looking at creating a number of journeys in SFMC based on the SF data. I have written ...
Matt Black's user avatar
0 votes
1 answer
34 views

Update EndDate by calculating through start date +duration(picklist field)

I wanted to updated the End date whenever the start date is update and it should always calculated the end date as below End Date = start Date + warranty duration field. the issue here is warranty ...
Puja's user avatar
  • 13
-2 votes
1 answer
40 views

Get Distance between 2 records [closed]

Get Distance between 2 records while creating the record in lead object lead assign automatically near owner base upon zipcode anyone have Apex logic how to create the logic? for(Lead ld:[Select Id, ...
sfdcCoder's user avatar
-2 votes
1 answer
55 views

I've tried writing a trigger for this, but I'm having trouble. Please help me out [closed]

Trigger RatingPopulate on Opportunity(after insert, after update) { OpportunityHandler.RatingPop(trigger.new); } Apex Handler public class OpportunityHandler { public static void ...
Arati's user avatar
  • 1
-1 votes
1 answer
46 views

Display total in headline bar, is a trigger my only option despite being read only?

The goal is to add a total to the headline bar in the Accounts layout. I will be using the Account object and from there it will need to pull "Total" from a custom object. The custom child ...
Unknown_Person's user avatar
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
1 vote
1 answer
35 views

New Vs Update in Trigger Actions Framework Flow

We recently started using the Trigger Actions Framework for both our flows and triggers. We have some flows that we need to execute for both updates and inserts. I can't find a way to check if the ...
salesforce Developer's user avatar
2 votes
0 answers
59 views

Custom Apex trigger creating duplicate records

I'm hoping for some help with some Apex code and/or other troubleshooting ideas if the code ends up looking okay. I'm a long-time SF Admin but super new to Apex (and to coding in general), and I'm ...
Rae's user avatar
  • 21
1 vote
0 answers
41 views

Flow not Triggering as expected

Flow should create a "move" when a repair record is created or updated with the repair vendor as "Rau Warehouse". The repair record I am using meets that criteria, but I have not ...
Alex's user avatar
  • 13
0 votes
0 answers
24 views

Is there any way to perform my required logic other than with recursion applied on a tree data structure?

This is the most complex logic I've ever worked with in Salesforce. I'll try to describe my requirement in simple terms. I have a custom object which has a date field(StartDate__c), and a number ID ...
Milan Vrลกkový's user avatar
0 votes
1 answer
43 views

Field not being written to in helper class

I am trying to schedule a batch job, take the Id of said batch job and then write it to a field on the triggering record.The scheduling works successfully, it just doesn't write to the record. Trigger ...
stormy's user avatar
  • 51
-1 votes
1 answer
45 views

Too many query rows: 50001 in Production

We are getting Too many query rows: 50001 error in production during a data load activity of an Sobject. we have an active trigger on this Sobject. But we have only 14K records for this object in ...
Raham's user avatar
  • 43
0 votes
1 answer
35 views

EventRelation - Retain record of contact's account relationship when contact added to event

I am looking for a way to capture the Account associated with a Contact at the time the Contact is added to an Event. Currently, the Account gets updated in the EventRelation object when the Contact'...
Michele Kleinhomer's user avatar
-2 votes
2 answers
70 views

Trigger to update parent record by child record . Please review my code and let me know where it went wrong

public static void Afterupdate(list<Contact> lstcon, Map<id,Contact> mapcont) { Map<id,String> accid = new Map<id,String>(); list<Contact> updatedcont ...
Santhosh's user avatar
-1 votes
1 answer
97 views

How to find the last activity (event or task) related to an object record?

In my contact object i have to update fields based on the last activity. If the last activity is an event ,update the field with event details and if it is task ,then with task details. How to check ...
sarah's user avatar
  • 13
0 votes
1 answer
51 views

Getter/Setter Variable not being called

I wrote a getter/setter variable to populate a map when an opportunity is updated. For some reason the code inside the accountProductForecastMap method is not being ran. I have used this similar ...
Kailey Prosser's user avatar
0 votes
0 answers
70 views

How to Unit Test Standard Platform Event in Trigger

I have a trigger on FOStatusChangedEvent, which is a standard event in Salesforce triggered when the FulfillmentOrder status is triggered. I need some help on how to unit test the standard platform ...
chanpelayo's user avatar
0 votes
1 answer
47 views

How do I create a trigger where only the owner of a case can edit the OwnerId field

How do I make a trigger so that the OwnerId field, which is a Lookup(User) field of the Case object, can only be edited by the Owner of the record
Extra7's user avatar
  • 3
0 votes
0 answers
17 views

Changing feed tracking automated chatter feed post user

I have a requirement to update this feedItem post generated from feed tracking automation to say System updated this record or a specific user such as an integration user as opposed to display system ...
michel mukeba's user avatar
0 votes
1 answer
59 views

Error on executing test class: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

I have written a test class for the below mentioned triggerhandler class but getting the below error after running the tests: System.DmlException: Insert failed. First exception on row 0; first error:...
Sai Bhargav's user avatar
0 votes
1 answer
48 views

Is there any way to disable automatic recalculation of UnitPrice when Quantity changes?

I have a flow that changes Quantity to OpportunityLineItem. This automatically changes the UnitPrice. I found a way to revert back - keep the original UnitPrice and do 2 updates to get back the past ...
Max Vitko's user avatar
0 votes
1 answer
61 views

Cannot get standardPricebookEntry's id

I'm trying to write an Apex trigger and class, to update a list-price of a Product in a Pricebook, once a checkbox is clicked on the product object. Here is all of my code: Class: public class ...
iluvcode's user avatar
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
2 votes
1 answer
52 views

Catch/handle exception plus rethrow them in separate transaction

I have a small Salesforce app called ISV Cockpit that helps AppExchange partners to get notified about their app's unhandled exceptions within subscriber orgs. For that, this app leverages Salesforce ...
Robert Sösemann'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
49 views

Trigger on OLI update seems to fire twice

I am trying to send an email notification if an opportunitylineitem field has changed. For this i created a trigger and it works well BUT it sends 2 emails and i don't understand why. Obviously one is ...
Langloic's user avatar
0 votes
1 answer
56 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
0 votes
0 answers
53 views

How to convert an OpportunityChangeEvent to an Opportunity object?

I am writing an async apex trigger for Opportunity. The trigger gives me an OpportunityChangeEvent object which has all the fields of Opportunity (in addition to fields like "ChangeEventHeader&...
SatheeshJM's user avatar
2 votes
0 answers
58 views

.run() on Apex class

Apologies if this is a trivial query but I have not been able to find an answer for this query in my online search. This is the code written for Task Trigger (all are currently working as expected) ...
Exps's user avatar
  • 263
0 votes
0 answers
49 views

Manage Platform Event Trigger Subscriptions From Apex

Is there a way to manage platform events trigger subscriptions programmatically? Specifically, I'd like to be able suspend and resume a trigger subscription using Apex code. I am aware of how to ...
Patrick Speranza's user avatar
0 votes
1 answer
59 views

How can i show the Campaign Name on a Lead field

So I've been trying to use a trigger. But it's not working. Ive created thid method that gets called in afterInsert and afterUpdate. So I'm testing it by adding a lead on Campaign Member and nothing ...
Testing1002's user avatar
0 votes
0 answers
33 views

Calling a flow that creates a list of uploaded files from an apex class is always one file behind

I am using a Flow to update a File_links__c on a record with the list of all the files for that record. This flow was originally a record-triggered flow. Editing any field in the record triggers a ...
ash's user avatar
  • 1
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
1 vote
2 answers
84 views

How does the system know how to do the before DML operations when you create new lists off of trigger.new

So say i put trigger.new in a list then i throw that list in a forloop and change field values. Well then somewhere at some point those values are saved to salesforce. In the context of before i don't ...
ensir's user avatar
  • 383
0 votes
0 answers
55 views

Got a limit exception error even when the soql query is outside the for loop

just a question. Let's say I have apex class that are updating bunch of records using dml in a list which will trigger if the picklist is change, then execute the code. If a dml is triggered, will ...
Squidward's user avatar
0 votes
2 answers
84 views

Optimize code for fetching Account hierarchy in loop

I'm using below code for fetching associated accounts when any account is deleted to update its parent account. I'm looping thru account hierarchy to identify top parent. Below is the code public ...
unflagged.destination's user avatar
1 vote
0 answers
95 views

Apex Trigger not triggering upon Field Change in Approval Process

I have a flow which calls an approval process on a custom object. The approval process changes a picklist field to either confirmed or not fulfilled based on the response. I have an Apex trigger on ...
Gowtham Sriram's user avatar
0 votes
1 answer
203 views

Not able to see Public Groups when sharing files

I'm trying to share files with my users. I can see individual users, but can't access the groups. My Public Groups don't populate in the Groups dropdown list, and if I just type in the group name, no ...
Ajinkyasd's user avatar
  • 335
0 votes
1 answer
145 views

Apex script unhandled trigger exception by user/organization caused by: System.QueryException: List has more than 1 row for assignment to SObject

received this error on apex exception.. Any help ? Apex script unhandled trigger exception by user/organization: 0052500000Bzp4a/00D25000000DwLO Source organization: 00D0Y000000sW5j (null) ...
Basha's user avatar
  • 3
-3 votes
1 answer
66 views

System.FinalException: SObject row does not allow errors on Batch

i am trying to create a batch that prevent from creating duplicate records. This is my classes and trigger Class batchCheckDoublonContact : global class batchCheckDoublonContact implements Database....
Amir Bouzid's user avatar

1
2 3 4 5
โ€ฆ
160