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
1answer
38 views

How to Deserialize the Trigger old & newMaps in JSON

I'm trying to pass the old & newmaps as arguments to a future method using JSON method. I see the below error when it tries to deserialize the data. reference-Passing SObjects to Future |...
-2
votes
2answers
61 views

Whenever an account name is modified send an email notification to the contact of an Account

Trigger is not go into the If Condition and Not compare Value. How to comapare oldAccount Name is notEqual to ModifiedAccount Name? And How to write query for the Id to compare the Name in the code.If ...
0
votes
2answers
60 views

Apex Trigger Order Of Execution

Correct me if my understanding is wrong - All the DML operations are committed only if the entire code runs successfully. I've carried out the following activity: Written a block of code which will ...
0
votes
0answers
58 views

Trigger to fire after 10 seconds only ONCE

I have a use case where I need to do an Aggregate SOQL on OpportunityLineItem(oli) & its opportunitylineitemschedules(olischedules). I have 2 triggers(Trigger1 on Opportunity & 1 on oli). On ...
-1
votes
1answer
161 views

Platform Events Subscription through Trigger and parsing a JSON payload field [closed]

We are going to implement platform events for inbound integration and subscribe to events using trigger. Among the platform event object, one of the fields is a long text area which has a JSON payload ...
0
votes
1answer
195 views

Could not able to retrieve VersionData from Content Version after insert of ContentDocument

I am trying to retrieve the body of ContentDocument after insert. Below is my code.My trigger is on ContentDocument (After Insert) public static void syncContentDocument(List<ContentDocument> ...
0
votes
2answers
22 views

AffterInsert PROBLEM

I am attempting to update a field on the Opportunity object with the project that gets created (that is associated to the opportunity) So basically the way things work is that when an opportunity is ...
0
votes
1answer
42 views

Repeated invocations of Trigger Dispatcher. Logs not helpful

I have a method in a trigger dispatcher that's being called in a recursive but seemingly untraceable fashion. The following log entries just repeat over and over until I reach maximum stack depth. ...
0
votes
1answer
23 views

How to abort Cronjob by name?

I have cronjobs which are scheduled in after update trigger. When some user make an update in one and the same record I need the previous cronjob(batch) to be aborted and to start a new cronjob. How ...
0
votes
1answer
270 views

Why is (Trigger.isInsert && Trigger.isAfter) not firing when running test class?

THE PROBLEM: My CustomObjectTrigger has a CustomObjectHandler class. I have code that is fired in the CustomObjectHandler class when the CustomObjectTrigger is fired by a new record that (isInsert &...
-2
votes
1answer
25 views

While Refering to the Account field why it will give error that variable dosenot exist please help

public class LeadHandler { public static void callme(List<Account>acc){ for (Account a:acc){ if(a.Type=='prospect'){//While refering Type it give an error ...
0
votes
1answer
31 views

update a field on contact once i associate a account

i wanted to update a field on contact once i associate a account. once accountcontactrelation is created i am checking if that relation role is Manager and if yes then only i wanted to update a ...
0
votes
1answer
46 views

Apex class INT_InteractionProcessor error- issue with Mailing City Mapping

Using a Webform (FormAssembly) to create an Interaction & Getting an error. Using the same form multiple times. it sometimes errors at the first submit and sometimes after the third submission, I ...
3
votes
3answers
355 views

How can I know if it's the last execution of an After Trigger?

Imagine one object with 20 fields, field1 to field20. Some of these fields I have Process Builder in place, some of them I have Worflow Updates, and some of them are 'bare field' (i.e. PB and WF does ...
-2
votes
1answer
47 views

recursive trigger on junction object

I'm getting an error while updating status how to avoid it trigger applications on Job_Application__c (after update) { set<id> candiadteIds = new set<id>(); List<...
0
votes
1answer
31 views

Updating records when related record is inserted

I have written at shipment insertion to update the shipment's expedited checkbox to be true, and then in the after trigger, it should update all the packages that have the newly created shipment to ...
2
votes
1answer
42 views

Failure setting lookups in triggers when upserting multiple records of different types very quickly

I have an integration app that polls records of different types from an internal database every few seconds and upserts them into Salesforce. I have two pollers that run independently from one another ...
0
votes
1answer
23 views

Compare a record with another record within a for loop and update the record accordingly

Here is my scenario. I have a custom object Milestone, child of Opportunity. When a milestone is marked as Status = 'Completed', then the trigger should populate the Start Time of next Milestone in ...
0
votes
1answer
44 views

rest post execution of AfterInsert caused by: System.NullPointerException: Argument cannot be null

i am doing an callout to a third parity using a trigger. and I am getting the error. CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY message: LeadCallout: execution of AfterInsert caused by: System....
0
votes
2answers
32 views

Create list of records in Before and delete the list in After Context

I need to write a trigger on Case object where I need to delete the placeholder records and relate the case to existing records. I need to prepare the list of placeholder in before context and delete ...
0
votes
1answer
508 views

Test Class for Content Document Link trigger

I have created a trigger functionality on after insert of content document link, trigger functionality is working as expecting. But when i have written a test class to insert test record for ...
0
votes
1answer
326 views

Using Maps instead of nested for loops in APEX

Hi i'm really new to Salesforce development in the following code I'm trying update existing record to inactive but, not the coming record on two different conditions. I'm a bit confused in the last ...
4
votes
1answer
108 views

Why won't Apex IF statement work in Production Unit Testing after working in sandbox?

this is driving me NUTS and any thoughts are MUCH appreciated after looking at this for far too long. Use case: users in certain profiles need to be automatically added/removed from a particular ...
0
votes
1answer
32 views

How can I test Messaging.MassEmailMessage with checking targetobjectids?

We have some User with UserRole. I need to verify that the email has been sent to the user with the role 'TestRole'. How can I do that? I try: List<Messaging.MassEmailMessage.targetobjectids> ...
0
votes
1answer
45 views

Same Logic for after insert and after update trigger?

I have to implement same logic x=y+z for after insert and after update trigger on an object. Unfortunately I cannot make use of context variables as our prototype for trigger handler is defined long ...
-3
votes
1answer
80 views

Test class with different scenarios for trigger helper

I have 100% coverage, but I still haven't scenarios for check. How to write good and bad scenarios for test class? This is my helper: public with sharing class JobHelper { public static List<...
0
votes
2answers
33 views

Can I avoid a code duplication here?

I have a code duplication here. How can I fix it? I want to make my code better. Helper: public with sharing class JobHelper { List<Task> taskList = new List<Task>(); public void ...
0
votes
1answer
83 views

How to make more methods in Trigger Helper class?

How can I make more methods in this Helper class, not just public static void? I also need a method for checking the update of Stage__c field (when we update another fields - Trigger shouldn't be ...
0
votes
1answer
32 views

Pass Subject and Description in new Case

I have an after insert trigger that is updating cases and I want to be able to pass Subject and Description on with casesToUpdate. Below is the code. I do not want to change the Subject or Description ...
0
votes
4answers
312 views

trigger when check box is check automatically create child record

Create the field called "Contact Relationship" checkbox on the Contact Object and Create the related object called "Contact Relationship" which is related list to the Contacts.(Look Up Relationship). ...
2
votes
1answer
1k views

APEX Lock and Unlock a Record

I wanted to lock and unlock records based on a check box. I know that you can do this stuff via a validation rule but I think that is difficult to maintain if adding fields. I wrote an apex trigger ...
0
votes
1answer
65 views

Unable to create Auto EventRelation record via trigger

I am trying to create an EventRelation record on insert of an Event. Basically I am trying to add WhoID of Event into invitees automatically. Am I missing anything. I am not getting any error also. ...
1
vote
2answers
53 views

Best way to process the records in After Update triggers - Sets or Lists

This may be a very primitive question but am failing to choose the best way and am trying to follow the best practices. We have many Salesforce Apps implemented, as a result there are many record ...
0
votes
1answer
60 views

Email sent twice on trigger

I have a requirement where I'm sending an email and also creating an email message record when certain conditions meet. However, the email is shot twice and 2 email message records are being created. ...
-2
votes
1answer
129 views

after insert,after update trigger doesn't work

Below is my trigger to create a new record(with next quarter) when Hold and freeze are set to true. But this works for new but not update. below is my trigger and . trigger AddingNewQuarter on ...
2
votes
1answer
70 views

Logic written in AfterInsert does not finish when beforeUpdate is called

We are creating OpportunityLineItem through Apex, now in isAfterInsert we are creating a Test object record whose Unique_Key is same as OpportunityLineItem unique_key. Now attaching the 'Test' to ...
1
vote
1answer
34 views

Why doesn't my code enter for loop when record found?

I have an object(Huishouden__c) with a related list. I loop trough the object records with a for loop on the related record. When I debug the object in the first loop I get an Id but it does not enter ...
1
vote
1answer
461 views

How to perform DML operation in after insert, after update trigger

I am new in developing apex. Here is my trigger. When I try to update an account record, I get the error: " Error:Apex trigger pfUpdate caused an unexpected exception, contact your ...
1
vote
1answer
72 views

How write tigger Insert & update other records same object with update query

I have this trigger where I insert a record. On the insert I want to check on birthdate and set a checkbox on true for the record with the oldest birthdate related to same Household/Huishouden__c. ...
-2
votes
1answer
45 views

Platform field value isnt updating in Document Level through Junction Object [closed]

Object structure: #Platform #JunctionPlatformDoc (junction object) #Document Platform contains its name and aircraft manufacture sosl field. I have to populate those fields in document Level, In ...
0
votes
1answer
502 views

Maximum trigger depth exceeded error while update

am getting the following error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Effectivefilingdate: maximum trigger depth exceeded Patent trigger event AfterUpdate below is my code-what is the change i ...
0
votes
2answers
71 views

How to populate owner name instead of id from a child object

Here i am trying to get owner name value from child object incident , OwnerId is populating correctly but when i tried with Owner.Name, value is coming null in debug log. Please find my piece of code ...
0
votes
1answer
152 views

Update a record based on the field update on any grand child record

I have three different objects A (Grand Parent), B (Child) & C (Grand Child). All the three objects are related by a lookup relationship. Now, there is field on A object, IsActive which is a ...
1
vote
0answers
149 views

Insert operation triggering NOT(ISNEW())

I would like to ask for help regarding why an insert operation would trigger and fail this validation rule: AND(NOT(ISNEW()), ISPICKVAL(Pipeline_Type__c,'Licence'), ISBLANK(Related_Pipeline__c)) The ...
0
votes
1answer
72 views

Accessing variables between visualforce page to controller classes

The following code is called from Opportunity trigger. So the flow is From opportunity trigger call MyTwiMLController.processoutboundCall() After the callout it calls the VF page "TwiMLPage" Then it ...
0
votes
1answer
63 views

Create Test Class for the simple Trigger

I'm writing a simple trigger for Contacts. But my coverage is 19%. Can anyone help me figure it out? My Trigger: trigger ConCase on Contact (after insert) { List<Case> CaseList = new List&...
0
votes
1answer
273 views

Formula not having updated value in After Trigger : Apex Trigger

updateTemplate((List<Object>)tp.newList, (Map<Id, Object>)tp.newMap, (Map<Id, Object>)tp.oldMap); In the method I am querying updateTemplate I have a query as below Map<Id, ...
0
votes
1answer
28 views

Triggering after update - difference between UI and Setup for Picklist value changes

I have discovered that if I change a picklist value from the UI, it triggers apex after updates, as well as Process Builder flows, while if I use the Picklist field window, and 'del/replace' the ...
0
votes
1answer
35 views

Trigger not fire

I have Case(Parent), Enquiries(child) objects. When Enquiries status is not equal to Processed then Case should not be closed. I have written trigger on child object. It's not working. trigger t on ...
0
votes
1answer
133 views

Error updating custom Salesforce object using Talend ETL - Status Code: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

I am trying to update the name of one of the Salesforce Custom Objects, and using Talend Data Integration tool for the same. The action on the salesforce Object is 'Update' and I only have two columns ...