All Questions
Tagged with apex-trigger or trigger
8,032 questions
-1
votes
2
answers
40
views
Updating latest case number on account, but its not working . Can someone please have a look and correct it
TriggerHelper class:
Public static void CaseIDUpdationOnAccount(List<case> caseList){
Set<ID> accID=new set<ID>();
For(Case C:caseList){
If(c.accountID!=null){
...
0
votes
0
answers
23
views
Trigger a PDF generation fail for testing without touching code
As SF QA, is there a way to create test steps to trigger a PDF generation fail? Once I complete an onboarding flow, a contract form generates. I need to test that once the form generation does not ...
-1
votes
1
answer
35
views
How to exclude a record type from an Apex Trigger
I have inherited some old triggers attached to Opportunities and I would like to stop this particular trigger from running if the record type equals "corporate".
At the moment, the trigger ...
0
votes
0
answers
24
views
Apex Sharing Rule for Financial Accounts not working
I need this apex sharing rule to fire when an Account Team Member is inserted, updated, or deleted. Account Team Members need access to the related Financial Accounts if they are a team member, and if ...
-1
votes
1
answer
37
views
Store User Login and Logout timestamp
I have a requirement where I want to store when a user logins and logouts.
The catch is
if one session is active I should not be allowed to login into another session.
Logout should also be captured ...
0
votes
1
answer
30
views
Alert Sys Admin when mass update or delete is performed on any objects
As a Sys Admin, I want to be notified by email when a mass update or deletion occurs in any object by any developer in the org. Is there an out-of-the-box feature that can be enabled in Salesforce or ...
0
votes
1
answer
46
views
Question on apex trigger scenario
I wrote this code for the following scenario and the scenario is:
Once an Account will update
then that Account will update with the total amount from All its Opportunities on the Account Level
The ...
0
votes
1
answer
25
views
Calculate hours within and outside business hours on TimeSheet
I need to calculate hours within and outside business hours on the TimeSheet object from the related TimeSheetEntry records.
My code was working, but not calculating correctly. I'm trying to update my ...
-1
votes
1
answer
38
views
Error while updating Account field while updating created Speaker record
I have created one Speaker record and i want to update/add "Account" field value, but receiving this error while saving it. So, can someone please let me know how to resolve this issue?
...
0
votes
1
answer
29
views
Order number should be populated serially
I have a requirement where orders are created by our users every minute. Once an order is created, it is in stage = draft. It then moves from Draft --> Submitted --> Fulfilled. Once it moves ...
0
votes
1
answer
48
views
Can a record-triggered flow retrigger itself?
The question pretty much explains itself. Can a record-triggered flow retrigger itself if the entry conditions are met? I know that an after save flow can trigger other flows/triggers with the update ...
0
votes
0
answers
29
views
What would caused the chained Queueable inside the batch to run recursively?
I have a batch that is scheduled to run daily.
This batch can delete and update the records.
this is the sample of my batch:
public class BatchTest implements Database.Batchable<SObject>, ...
1
vote
1
answer
49
views
Apex triggers can't reference external objects or call out to external data sources [duplicate]
I have a custom object called 'BidManager_Bid__c'. On this object, I created an External Lookup field called 'Global_Opportunity__c' that reference to the external object called 'Opportunity__x'.
I ...
0
votes
1
answer
21
views
Issues with test class receiving an Internal Salesforce error with Change Data Capture Trigger on ProcessInstanceStep
The below test passes, but I'm receiving Salesforce Internal Error, which is preventing coverage on the trigger and trigger handler class. I tested the functionality outside of the test class and ...
0
votes
0
answers
22
views
Salesforce on record update display an alert [duplicate]
is there any possible way when updating a record there will be a pop up alert?
or any Idea on how to do it? I need a pop up message when the record is updated, I tried creating a record-trigger flow ...
0
votes
1
answer
25
views
Salesforce User with a certain profile can only delete contact base on Account.field__c and the user.field__c is the same
Salesforce User with a certain profile can only delete contact base on Account.field__c and the user.field__c is the same.
do you guys have any ideas on how to do this. I need the user to delete a ...
0
votes
1
answer
149
views
User does not have access to object, but can still insert and update data in apex
Currently I have a user with a profile that does not have edit and create permissions, including permission set. But when calling into apex, it still inserts and updates data.
Can anyone explain to me?...
0
votes
0
answers
42
views
Why update trigger is fired on master record when there is no field update after merge dml on master record
I ran this code from dev console
Account masterAcct = [SELECT Id, Name FROM Account WHERE Name = 'Account1'];
Account mergeAcct = [SELECT Id, Name FROM Account WHERE Name = 'Account2'];
merge ...
0
votes
0
answers
48
views
Why is a Before Update Trigger firing whenever I open a Record?
I have this problem that whenever I open a Case record the Last Modified Date gets changed to the current date/time. Debugging I've found that the Before Update Trigger is firing when I open the ...
-1
votes
2
answers
60
views
I am trying to create a LWC component , trigger , apex class but facing the same issue
When I try to create the LWC Component , Trigger and Apex Class I face the same issue.
Here I am creating the LWC component calculator but facing this issue
20:01:40.600 Starting SFDX: Create ...
0
votes
0
answers
87
views
Issue with Trigger.oldMap and Trigger.newMap not showing correct old value in after update trigger
I have an after update trigger on a managed package object (TasksObject__c). In this trigger, I need to check the old value of the Status__c field. When I update the Status__c field from 'In Progress' ...
0
votes
0
answers
55
views
How to create APEX triggers in salesforce using jsforce library
I am trying to create an Apex trigger on the Account object using jsforce. I've successfully established an OAuth connection, and I can query and create records without any issues. I've also tested ...
1
vote
1
answer
51
views
Apex test method code coverage using fflib_ApexMocks is skipping the selector
I am trying to use the fflib_ApexMocks and testing it on my test class but it keeps on skipping the selector in the code coverage.
Please help.
Thank you.
AccountTriggerHandler:
public static void ...
0
votes
0
answers
30
views
When CallAcceptDateTime is populated in VoiceCall record
I need to know when the CallAcceptDateTime on a VoiceCall records is populated in order to create a Case records in that moment. I have written the afterUpdate method in our voicecall trigger but it ...
0
votes
1
answer
97
views
Checking Record Type Id of object
I have a requirement to check the record type of a custom object being iterated over in a for loop (ContentDocumentLink) as part of an after insert trigger.
I have tried the following, assign Id ...
0
votes
0
answers
92
views
Generating PDF from Quote - No output via Flow
We utilize a third-party program to generate Quote PDFs - "Quote Editor". It uses VF pages as templates to do so. This works quite well using its native functionality (but this requires ...
2
votes
2
answers
166
views
Unusually Low CPU Time Recorded by Limits.getCPUTime After DML Operation in Platform Event Trigger
I’ve encountered an unusual behavior in Salesforce Apex when working with a Platform Event. Specifically, it seems that Limits.getCPUTime returns an unexpectedly low value after performing a DML ...
1
vote
1
answer
46
views
How can I save a log of every attempt to insert a Lead without duplicate logs?
I have a requirement that every attempt to insert a Lead gets logged into a custom Lead_Log__c object. I cannot seem to get this to work while handling partial success inserts and also inserts of >...
2
votes
2
answers
256
views
Trigger (after delete) restricts from deleting records
Can you help me figure out what is the issue with the following trigger method?
(see error below; when to delete employee with inactive trigger, record is deleted)
This trigger:
trigger ...
0
votes
1
answer
24
views
Validate record on update by doing callout
Question:
If any one is updating the status of Project as Live, I want to first validate it by doing a callout and if response is success then allow the status to be updated as Live, else show error ...
1
vote
2
answers
94
views
Is Apex Trigger considers two updates on different records from two users into a single transaction?
If 2 users in SF try to insert accounts at the same time(assume it) considering we didn't bulkified our code in helper classes.
Now we know, whenever users try to use such functionalities from SF UI ...
0
votes
0
answers
45
views
Optimizing Apex Trigger Code on Opportunity [duplicate]
I've built a few custom Salesforce flows on the Opportunity object to automate processes, however I keep running into the reoccurring issue of the SOQL queries timing out and my flows failing the ...
0
votes
0
answers
37
views
Flow is not getting triggered
I have configured a webhook URL in outbound messages and have set a flow for Opportunity update with action as configured outbound message.
The issue I am facing is the trigger frequently fails to ...
0
votes
0
answers
42
views
Quote Line Group Field in Order Object always coming as null before or after insert Triggers
I want to display the values of the Subscription Vendor Name and Delivery Mode fields in the Order object.
The logic is as follows: When the order is created, it should check the Quote Line Group (...
0
votes
0
answers
59
views
Second Case milestone within an entitlement is not getting tagged automatically
Whenever I create a new case the trigger does auto triggering of entitlement tagging and the first case milestone criteria starts. Now if it violates then a field update of escalation level field is ...
0
votes
0
answers
76
views
Callout loop not allowed without additional callouts
I checked the existing posts on this however I have only one callout.
Error - {"statusCode":"UNKNOWN_EXCEPTION","message":"Callout loop not allowed"
I am making ...
0
votes
0
answers
76
views
Custom Approval Process with Parallel Approval
I'm really having a hard time to meet this objective because the Standard Salesforce Approval Process does not provide the Parallel Approval
Here's what we have done so far
Salesforce Flow is the ...
0
votes
1
answer
41
views
AfterTrigger not working as expected as account not getting updated
I want the amount on all the opportunities related to an account to be aggregated on the Total_Amount__c field on the Account. Below mentioned is the Trigger on the opportunity(Just added for the ...
0
votes
0
answers
63
views
Accessing relationship fields for setting and filtering using fflib
We are starting to use fflib in our projects. We generally run into disagreements on how we access relationship fields and as well copy values from related fields and set a object field. To set a ...
0
votes
1
answer
74
views
Can we perform some action on metadata changed?
Whenever the metadata is changed in salesforce can we write any trigger or flow to identify that the change happened in metadata then we can perform some action like sending an email from the apex or ...
0
votes
1
answer
58
views
What is the better way to know if the value was already used in the record previously?
I need to have a validation wherein a certain picklist value (e.g: in progress) was already selected before in the record. So basically, the "in progress' status should only be selected once in ...
1
vote
1
answer
174
views
How to get Standard Pricebook Id in a flow when triggered from a test method?
Can you help me figure this out? I want to test an apex backend controller method that creates an agreement, or a contract object with other words. Problem is that when I prepare the test data in the ...
1
vote
1
answer
58
views
How can you access a dynamic related list from an object?
I have a dynamic related list "Qualified Contacts" in my Account object, that filters contacts based on tenure (custom field). I want to access this filtered list in a trigger, however I ...
-2
votes
1
answer
147
views
Trigger automation when row added to Data Extension (without external API)
I want to trigger an automation when a new row is added to a Data Extension.
I can trigger it via the API, but building this trigger inside the Marketing Cloud would be much better because otherwise, ...
-1
votes
1
answer
72
views
How to remove child lookup which is populated on parent when the associated child is deleted
On the account object we have a contact lookup field
We have multiple contacts as a related list on accounts right
When we delete the contact record/ update the account on contact record, if it's ...
0
votes
2
answers
75
views
Trigger to update mailing address of contact record when billing street of account record is updated no compilation error but contact not updating
public static void UpdateBillingAddress(Map<id, account> MapOFBillingAddresses)
{
list<contact> ContactBillingAdressUpdated = new list<contact>();
set<id> ...
0
votes
0
answers
53
views
Before Trigger on User also firing as an After Update Event
I have a before trigger on user which checks if a checkbox is selected and assign a manager if user's team matches another user's.
The issue is that the trigger should only run on before insert or ...
2
votes
2
answers
327
views
Does Salesforce Pro Suite allows you to do apex?
I have been looking for this answer, but can't find it. Do you guys know if you can create apex classes or triggers in salesforce Pro-Suite?.
0
votes
1
answer
93
views
Test Class for the Apex Class? In above I am calculating time spent by record in each stage? I tried writing test class but unable do test coverage? [closed]
In the below, I am calculating time spent by the record in each stage. I tried writing test classes but was unable to do test coverage.
trigger Approval_Agreement on Approval_Agreement__c (before ...
1
vote
2
answers
818
views
Bypass flow and apex triggers when executing DML on batch apex
I am thinking of a way to bypass triggers from both Flow and Apex when I execute the DML statements on my batch class.
Framework setup:
I have a Hierarchy Custom Setting that has checkbox fields per ...