We’re rewarding the question askers & reputations are being recalculated! Read more.

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
25 views

Parent or Child record fires BeforeUpdate trigger first when attached in Lookup Relationship?

Writing a trigger to handle updating a few fields on a record (of the same object, this is an Account to an Account lookup) when it is attached via a lookup relationship (ie. it is the parent or ...
-1
votes
0answers
33 views

Trigger : After update | Need to create records on custom object [on hold]

if(trigger.isAfter){ if(trigger.isUpdate){ List<Document_c> recordInsert = new List<Document__c>(); for(Case newCaseData : Trigger.New){ if(trigger.oldmap....
0
votes
1answer
27 views

Apex extracting fields from a trigger to create a custom JSON

I have created a trigger for Order Object and only want specific fields to be pulled from that object to create a custom JSON data structure. I have tried saving the fields that I need from the object ...
1
vote
0answers
43 views

Problem with trigger time executions

I have 2 triggers after insert wich call one apex class each one. One of them call an apex class for make a query to get an Id from the first trigger execution. I need this ID to match two differents ...
0
votes
1answer
74 views

Test Case - Attempt to de-reference a null object (Formula Field)

Now I have 0% coverage. System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CaseHandlerCountAlert: execution of AfterInsert caused by:...
3
votes
1answer
63 views

How do I avoid a Duplicate-value during update in Trigger?

I'm changing the Clients__c value in Mopping__c if the StartDate__c, Status__c or Opportunity__c have changed in the needed Rent__c. Structure: if Mopping 1 is related to Rent 1 which is related to ...
-6
votes
0answers
25 views

need test class For below code [duplicate]

this trigger update the all child records amount in Account Object when after:insert,update,delete,undelete..i dont know how to write test class Trigger: trigger SubscriptionTrigger on ...
0
votes
1answer
25 views

Trigger code error

I am really new to triggers and not sure how I fix this error, please help. Thank You, Lorr
0
votes
3answers
70 views

Update map.values() doesn't work

I don't know why my object's field from map doesn't change. Can you help me please? public void changeCommentAfterUpdate(List<OppDesc__c> newOppDesc){ Map<Id, Tool__c> mapToConnect = ...
0
votes
1answer
22 views

Trigger on Account to create case when account customfield is of type Multiselect picklist is updated

I'm having plan__c field on account object.whenever its is updated I want the new values of plan__c is the subject of a case and new case to be created if new values and old values match no case is ...
1
vote
1answer
52 views

ContentDocumentLink fires trigger multiple times on list insertion [duplicate]

We have a trigger on Order attachment insertion, so that a field is populated with a link to the attached documents whenever a user uploads one or multiple files to an existing Order. We created the ...
0
votes
0answers
15 views

CPQ-Custom field blank value email template after submit for approval on Quote

On CPQ Quote: I am a newbie to salesforce and CPQ. When quote is Submitted for approval, email templated is triggered named quote submitted for approval from CPQ package.In that email template custom ...
0
votes
1answer
33 views

Trigger after update: System.FinalException: Record is read-only [duplicate]

I have a trigger: if(Trigger.isAfter && Trigger.isUpdate) { for(SomeRecord__c newRecord : Trigger.new){ if(Trigger.oldMap.get(newRecord.Id).Worker__c != newRecord....
0
votes
2answers
32 views

What's the difference in value of Trigger context variables new and old? [closed]

I have a confusion please can anyone solve it. I know it is silly but I am new to Salesforce so I need help. In before update and after update what will be the difference between the values of ...
0
votes
2answers
45 views

How to copy LinkedEntityId/Opportuntiy id in Content version object via Apex trigger

I have created a custom field(lookup field to opportunity) on Content version object that would denote the opportunity id that file is connected to. The custom field is Opportunity__c. Here is the ...
0
votes
0answers
27 views

How to Write Trigger When User Role change Remove Permission Set For That User [duplicate]

// AFTER DELETE public static void deletePermisionAfterUpdate(List<User> lstUsers ,Map<Id,User> mapOldUsers){ List<PermissionSetAssignment> deletePermissionSets = new List<...
-3
votes
1answer
51 views

when field on child object is updated to have a value, change field on parent to be null trigger

working on this trigger for 2 custom objects in a master-detail relationship, rep is the parent, role history is the child. the insert part works perfectly, just am struggling with the update portion. ...
0
votes
2answers
31 views

if field is updated to no longer be null, change different field

working on this trigger for 2 custom objects in a master detail relationship. the insert part works perfectly, just am struggling with the update portion. i've included the entire code in case my ...
0
votes
2answers
77 views

How to query Parent object of Master-detail relationship in trigger?

So I just realized that parent fields are not available on child triggers without querying. But i've tried several different methods and do no get the expected response. I want to create a campaign ...
1
vote
1answer
50 views

After Update Trigger and wrong values

I have a Trigger and Trigger Helper. Opportunity is a parent for CompanyOrder__c. One Opportunity can have many CompanyOrder__c records with uncrossed Start- and End Dates. CompanyOrder__c is a ...
-2
votes
1answer
53 views

Run Update Trigger only if a few fields are changed [closed]

I have Trigger and Trigger Helper. My trigger looks like that: if(Trigger.isAfter && Trigger.isUpdate) { TriggerHelper.updateTools(Trigger.old, Trigger.new); TriggerHelper....
-1
votes
1answer
35 views

AgentWork Trigger After Update is not cover using test class

I am writing a trigger On AgentWork with helper class. I have to write a trigger helper test class to cover helper class. Helper class successfully cover but trigger not cover for the helper test ...
0
votes
1answer
51 views

field change on child object auto populate parent field trigger

what am I doing wrong so that it only displays the new role? multiple roles should only be displayed if multiples are selected in the muli-select picklist. also, is it possible to have a space appear ...
0
votes
1answer
18 views

Populate Highest Segment on Parent Account

We have a Segment picklist field that separates our accounts by platinum, strategic, premium, ect. We want to have the parent account display the highest segment of all the child accounts which could ...
0
votes
0answers
25 views

Can I export attachments using Command Line Dataloader and use ANT to get it to FTP site/Google drive

Background: I want to run an after update opportunity trigger that would fetch all the opportunity records as well as attachments and then transfer it to a third party-website. In order to do that, I ...
0
votes
1answer
33 views

bringing Process Builder into trigger

I am trying to bring a process builder into a trigger and am having some trouble getting my apex class to know when a field changes. I've tried to research this and haven't been able to come up with ...
1
vote
3answers
75 views

Limitation with callouts

I want to listen to the change in permissions of salesforce records. For that, I am thinking to fire a callout from an afterUpdate method of a trigger. Whenever a record is updated through any means, ...
2
votes
1answer
32 views

How to Capture Approval Comments in Case Object Custom field called comments ? Below code i am getting an error trigger depth exceeded?

trigger CaseApprover1 on Case (after update) { List<ProcessInstance> instances = [SELECT Id,TargetObjectId,(SELECT Id, StepStatus, Comments FROM Steps) ...
1
vote
2answers
54 views

Hari Krishnan based Trigger Framework executes twice on After Update

I have a trigger framework based on the work by Hari Krishnan: An architecture framework to handle triggers on the Force.com platform, however I have functionality on After Update in wich a trigger ...
1
vote
0answers
19 views

Does Apex lead conversion trigger Contact before/after insert triggers? [duplicate]

I have some updates I'd like to make on converted leads. I had it in my lead code - first convert the lead, then query for the converted contact and update. However, that was triggering ...
1
vote
1answer
68 views

System.TypeException: Invalid integer: (Lead-0002)

I have created a round robin assignment of leads to users. I am getting the following error Lead_Trigger: execution of AfterUpdate caused by: System.TypeException: Invalid integer: (Lead-0002) ...
4
votes
1answer
58 views

Need help in optimizing the below helper class

Logic : For any new record inserts for 'Properties' object, check if its Account_Ref_Ext_ID__c equals to 'Account' object's Chris_Account_Number__c. If it matches, assign Account id to properties ...
0
votes
1answer
45 views

List must not have two identically equal elements: bulk test

I have after insert Trigger and I'm trying to test it with this logic (for bulk testing). It's a little test from Execute Anonymous Window: List<Lib__c> lb = new List<Lib__c>(); string s =...
-2
votes
1answer
27 views

Trigger after insert: can't update a record with no direct connection

I have this construction: If we create a Factory 2 with InDateTime__c = OutDateTime__c of the Tool 1 with the same Opportunity 1 (with another Factory 1 with the same Opportunity 1 relationship), ...
-1
votes
1answer
28 views

Whenever I update a account, if the account name contains 'test', it should be changed to 'test1'

Its working fine if the account name contains 'test' but if it contains 'TEST' or any other uppercase/lowercase combination other than 'test', its showing 'maximum trigger depth exceeded account ...
0
votes
1answer
121 views

After update trigger getting same old and new values in trigger.old and trigger.new

I have custom objects called Asset__c and Site__c. Asset__c has a lookup field to the object Site__c, which is called Asset_site__c. There is a formula field in Asset__c called Asset_Site_Name__c ...
0
votes
1answer
41 views

CPQ execution of AfterUpdate caused by: System.FinalException: Record is read-only

On CPQ quote object When we click on submit for approval button, status is changed to In review, when the status is changed to in review. I Have to populate a field from quote associated ...
0
votes
2answers
46 views

Update failed. First exception on row 0 with id ******; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadTrigger: maximum trigger depth exceeded

Error on Line 154: Update failed. First exception on row 0 with id ******; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadTrigger: maximum trigger depth exceeded public class ...
0
votes
1answer
58 views

I want to update Checkbox(Custom Field) on Contact whenever a new Opportunity is created based on Contact in (Primary_Contact__c)

I want to update Custom Field(Checkbox) on Contact whenever a new Opp is created and Opp has Primary Contact from Contact trigger PrimaryConOnAccOfOppHandler on Opportunity (after insert, after ...
0
votes
0answers
25 views

Can someone help me how to write Test Class [duplicate]

I just want to know how to write Test Code.. I've no Idea About it. If Someone can Explain me what are the keypoints to write a Test Class I've also tried to write Test Class. In this Test Class It is ...
2
votes
2answers
45 views

trigger to update Custom field on Account record whenever a new opportunity record (Whose Title contains 'CEO') is inserted or deleted

Trigger to update Custom field(Count_Of_Title_in_Opp__c) on Account record whenever a new opportunity record (Whose Title contains 'CEO') is inserted or deleted Trigger trigger OppSizeOnAccount on ...
1
vote
2answers
67 views

Trying to update Values in Standard Object from metaData

Trigger is updated to Before UPdateI am using Trigger isBefore In System.debug(opp.get(metaData.get(0).Opportunity_Field_Name__c) it is showing correct Values but not Updating in Opportunity Object ...
1
vote
2answers
55 views

How to convert this trigger to apex Class

I've written this trigger to Update Total Numbers of Contact in related Account Custom Field... All Code is written in Apex Trigger However, I've been told that it's best practice to split this into ...
1
vote
1answer
25 views

trigger to update a custom field in account when related opportunity is created with same value as in custom field of Opportunity

Can someone please elaborate what is mapAccounts.get(opp.AccountId) is getting here MapAccount acc = mapAccounts.get(opp.AccountId); trigger OppTrigger on Opportunity (after insert) { if(...
2
votes
2answers
50 views

trigger to update field on Account record whenever a new Contact, opportunity record is inserted or deleted

Number fields on Account : "No of Contacts" Write trigger to populate/update field on Account record whenever a new Contact record is inserted or deleted. -- whenever i am deleting last contact ...
-4
votes
1answer
74 views

Trigger not creating a new record [closed]

If case status got change for certain record type, new support record should get created. I configured status and record type combination in custom setting I am trying to avoid nested loop in my ...
0
votes
1answer
23 views

upsert from apex trigger

How can we upsert records to glocal picklist values from trigger? I wanna get existing records from a custom object and upsert the records to glocal picklist value by trigger. What type of trigger ...
0
votes
1answer
44 views

Why are field updates inside an Apex trigger not showing up in an Apex test?

I have a very strange issue with some Apex tests for a trigger. The tests each check a different type of field update; when one field is changed, the trigger is supposed to change another field. On a ...
0
votes
0answers
19 views

Accounts are in the wrong Company Group and failing to create new Company Group

I need help to find error in my trigger. I have created trigger for the following points but its failing to create Company group. Could you please see and suggest me. Contact is the parent of Company ...
0
votes
1answer
35 views

bypass trigger on specific object in salesforce

I need to bypass trigger on account sometime. I have created custom setting for that and added triggerObject__c field. In my code bypassTrigger__c bypass = bypassTrigger__c.getInstance(UserInfo....