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.

38 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
3k views

ContentDocumentLink Apex after insert trigger error

Edit: I've built an after insert trigger on ContentDocumentLink. On cropredy's direction, I've bulkified my code and I think improved it generally. It "works" in that it accomplishes my business ...
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) ...
2
votes
0answers
474 views

AgentWork trigger is not firing before or after insert events

I have created an after/before insert trigger defined on AgentWork object. When a case is created from Email to Case, the record is automatically routed to an available Agent from a queue by Omni-...
2
votes
2answers
378 views

After insert trigger not reading lookup values

I have object customObjectA__c which has a lookup fields - lookupfield1__c I have an after insert trigger which, at some point, checks if that field is populated. The whole issue is, it's reading ...
1
vote
0answers
158 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 ...
1
vote
1answer
308 views

Insert/Update Record on other Object

Requirement :- Need to Insert records in to Custom object (Merged_Account__c) and Update when Account with same id already present in Merged_Account__C. Merged_Account__C Object having custom fields(...
0
votes
0answers
14 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
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 ...
0
votes
1answer
101 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
2answers
41 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
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
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 ...
0
votes
1answer
57 views

How do I insert a multiple list of records into an object which is from the result of a SOQL query in trigger?

I get multiple records from the records list and now I want to insert as new records in an object. Should I create a map or should I do that? records output is checklistTemplate__c:{Name= Test, Id = ...
0
votes
2answers
73 views

Apex trigger to execute after batch is finished?

I have 2 Orgs let's call them A & B. I have a process that queries org A and transfers data into Org B. For simplicity, let's say OrgA.Id OrgA.ManagerID After my upsert I end up with a record ...
0
votes
0answers
67 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 ...
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
318 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
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
36 views

Can I update an account field when an email is sent from that account?

How can I update an account field called "Last_Contact" when an email is sent from the account with the created data of that email? I tried doing it via a field update and starting building the ...
0
votes
1answer
174 views

After Update Trigger to update parent status when child status is updated

I have a requirement to update parent status when child status is updated. Service is a child object and subscription is a parent object.Service has a self lookup.If child services status is updated ...
0
votes
1answer
38 views

Need a help for validate trigger on lead

I have written one trigger on Lead- Requirement:- On Insert/update Lead,If Leadsource is "Web" and if Lead company matched Any account Name then Populate the Id of that lead into ...
0
votes
1answer
28 views

Track of account records into alternate contact (custom object) records

We need to track any change in billing Address ( address,city,state,zip) of Account in a new Object : ÄLTERNATE CONTACT (Address, City,State, Zip, UpdatedDateTime, Account) . This object should ...
0
votes
0answers
288 views

How to use current record Id (In after insert trigger) to save it in some different object?

Please find my scenario below I will talk in generic words so that the objects name should not confuse someone. I have written after insert trigger on an object and obviously, I am getting the Id of ...
0
votes
2answers
70 views

Apex Trigger on OpportunityLineItem: Attempt to de-reference a null object error

I've been trying to figure this error out for a while now and it seems that I just can't figure it out. When adding an opportunitylineitem to an opportunity, I keep receiving the error "Attempt to ...
0
votes
0answers
214 views

Automate Chatter Post to Specific Users When Creating Log a Call Record

I'm hoping that there is someone who can assist me with an automation/trigger question with regard to using Log a Call and Chatter integration. When using Log a Call, one of our teams has requested ...
0
votes
0answers
64 views

Converting a Trigger into a Class Auto follow in chatter

I am very new to Apex, and was hoping that someone could help me. I do have a trigger in place, but would like to convert it into a Class. I will be calling this class from a new trigger, but I lack ...
0
votes
1answer
27 views

Need to update a field in case based on certain conditions in child object

I'm trying to update a field called Survey Sent field on case object. But before this update that there are certain fields on the child object, which impacts on update on survey sent on case object. I ...
0
votes
1answer
66 views

Open to opportunity instead of contact after lead conversion

I was able to reuse code from the another post to successfully convert a lead and have it open to the Opportunity after the conversion. But that code bypasses the VF page that lets you match up to ...
0
votes
1answer
34 views

Error in Trigger used for creating records in Opportunities based on the Campaign Members

I had a requirement where i need to create records based on the Campaign Members in the Opportunitie.i had done the trigger and the code was working fine but today i had an error Error:Apex trigger ...
0
votes
2answers
77 views

I am not able to run this trigger on contacts related to accounts

what i am trying to do is make a trigger on contact in which field acc_number__c is updated in Contact from the account field acc_number__c if the checkbox field final_number__c is selected in the ...
0
votes
1answer
133 views

INVALID_FIELD, All accounts must have the same current owner and new owner.: [OwnerId]

I am trying to cascade the same ownerid across all contact owners within an Account Contact Relation hierarchy. I wrote a pretty basic after update trigger on an account to accomplish this. When all ...
-1
votes
1answer
40 views

Auto creating subfolders in box.com through salesforce

Below is my code for auto creating the folders in opportunity but it is throwing me the below error for my code... Error: List has no rows for assignment to SObject Code: public void ...
-1
votes
4answers
345 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). ...
-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 ...
-3
votes
1answer
97 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<...