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
0answers
13 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
30 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
31 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 ...
-1
votes
0answers
12 views

iterate through a collection to update [duplicate]

I am working on a trigger between 2 custom object in a master-detail relationship Rep and Role History. The objective is to have active roles set on the Role History object via the Type__c field ...
0
votes
2answers
36 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
45 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
68 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
48 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
52 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
30 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
50 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
24 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
71 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
28 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
42 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
17 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
50 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
40 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
26 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
27 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
100 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
38 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
40 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
54 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
66 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
52 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
23 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
48 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
73 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
22 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
43 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
18 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
33 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....
0
votes
1answer
53 views

Consuming a REST api in Salesforce

I need to create an integration between Salesforce and a third party service. Essentially Salesforce will trigger a callout to the third party when a status change occurs on a custom object record. ...
0
votes
2answers
46 views

Apex after insert trigger - variable does not exist

I am calling another class from my trigger and it works in sandbox, but when I try to validate my deployment (I am using a change set to deploy) in prod, it says "variable does not exist: ...
0
votes
2answers
106 views

Follow Up Task in creation of new Task

I am getting bit confused on the probable answer as to what would happen on executing the below code block (considering trigger event as After Insert and scenario as to Create a Follow Up Task ...
0
votes
0answers
23 views

Method does not exist or incorrect signature: void setToaddress(List<String>) from the type Messaging.SingleEmailMessage [duplicate]

trigger mailsentcreateaccusindtri on Account (after insert) { //list<string> mail= new list<string>(); if(trigger.isafter && trigger.isinsert) { list<...
-1
votes
1answer
71 views

Trigger; Initial expression is of incorrect type, expected: String but was: List<String>

//trigger code trigger mailsentcreateaccusindtri on Account (after insert) { //list<string> mail= new list<string>(); if(trigger.isafter && trigger.isinsert) { ...
0
votes
2answers
63 views

How to retrieve Parent's Id of a triggered child record, inside the trigger - Solved

Certification__c(Parent object) --> Exam__c(Child object) Trigger triggers when Child is updated. trigger certificationToFailedNew on Exam__c (after update) { //List out all the exams associated ...
0
votes
1answer
53 views

Execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject () [duplicate]

Heres the error that I'm getting: Execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject () I believe the issue is with the following lines, which aims ...
2
votes
1answer
86 views

Insert and return in test data factory

Why do we sometimes add a new record to an object and then just return the variable and sometimes we insert it too. I am confused, can somebody clarify me on this?
0
votes
1answer
33 views

Task execution of AfterInsert Error for Task Trigger CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

So I have a trigger and a class that works perfectly when I manually test in sandbox but when I run a test class, I get the below error: 13:50:50:330 EXCEPTION_THROWN [49]|System.DmlException: Insert ...
0
votes
0answers
129 views

“Apex trigger SBQQ.OpportunityAfter caused an unexpected exception message when on a opportunity and click on ”Contracted" checkbox

I got this in my email Error type: SBQQ.ContractService.ContractServiceException Reason for error: A primary quote is not specified for this opportunity. Please make sure you have the primary ...