A trigger is an apex code, that can be executed before or after DML operations

learn more… | top users | synonyms

0
votes
0answers
4 views

Question on email notification alerts to customers

So I've been reading up on Workflows, Triggers and Email Alerts and what I want to do appears possible without having to write custom Apex stuff. Our objective is to send email reminders to customers ...
-1
votes
0answers
8 views

Apex Trigger for deleting the records in related list after status is failed

I have two objects software update and software request which have a lookup relationship when software update is set to completed the software request which are set to be failed should be removed ...
3
votes
1answer
17 views

Trigger to count most frequent recurring value in a related list?

I'm wondering whether its possible to use a trigger to find the most frequently recurring value in a related list, and then populate a field on the parent object with that value. And if so, what ...
1
vote
1answer
14 views

Updating master record with contents of detail record

I have a master detail relationship between accounts and a custom object, memberships. The membership object contains fields for start date, end date, membership package (picklist) and subscription ...
1
vote
1answer
18 views

Adding a field into Workflow Time Trigger Edit Drop Down Menu

New here. I'll be as brief as I can. I'm trying to trigger a mail before a subscription expiry date. I have two tables: A 'Contact' Table and an 'Account' Table. How can I add an 'Account Expiry' ...
1
vote
1answer
32 views

How can I update a record in before trigger

I have a task where I need to check if the record which is getting inserted has any duplicate value if there is any duplicate value then change islatest boolean field to true in the latest record and ...
0
votes
1answer
20 views

Trigger to move values between fields using a checkbox

I am new to apex and need to write a trigger on the Contacts object to move the values of X_field (multipicklist) to Y_field (multipicklist) when Z_field (checkbox) is true. X_field should then be ...
0
votes
2answers
24 views

Test Class Failing

I'm having trouble getting my test class to pass tests. Getting: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ...
4
votes
1answer
19 views

Database.convertLead() creates Account, Contact and Opportunity but leaves Web-to-Lead Lead unconverted

I've written a trigger to auto convert leads coming in from a web form. When I send the information from the web form, the Lead is created, the trigger runs the Database.convertLead and I get an ...
0
votes
1answer
49 views

Trigger not working, not able to understand the concept of list map

I am building a trigger on an object called project board. so whenever a record is updated/inserted I want it to fire. It is linked to another object called project. So what I want is to count all the ...
1
vote
0answers
13 views

Getting INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY insufficient access rights on cross-reference id: []: Trigger

This Error am getting while editing the Task. For first time it is saved i,e. Insertion. but after insert am trying to edit, The above error is occurring. I have checked the object permissions for ...
6
votes
1answer
52 views

Can this trigger logic be improved? Potential map redundancy

It seems like something this simple shouldn't require 3 separate maps. I'm querying for the Account and Contact using the Account name pulled from the auto-generated case subject. Any tips are ...
2
votes
0answers
18 views

Apex Code maximum trigger recursion depth with allOrNone false allows successful DML?

We recently changed some logic in a trigger, and some of the updates in the trigger mysteriously started to fail. Afterwards, we set up a simple test case to see if we could locate the cause of the ...
0
votes
1answer
13 views

How can I troubleshoot my dysfunctional Trigger-Ready Flow?

Currently following the "Calculate Discounts on Opportunities" in the "Cloud Flow Designer Workbook" (starts on page 26.) I'm 99% positive that I've followed all the instructions exactly. But when ...
3
votes
3answers
115 views

trigger design pattern

I was watching some videos on apex best practises and I spotted some discrepancies in advice people give. I wonder how you people code your triggers. The recommendation is to have one trigger per ...
1
vote
1answer
29 views

Apex Trigger: After Update - need to update fields as part of query

I'm trying to make an email send to all contacts that are on an account related to a contract. To trigger it, I thought I'd have a field update on the record using time-delay workflows, and then the ...
1
vote
1answer
11 views

How to make matching fields (in unrelated records) trigger workflow?

I have professional edition, but we have access to workflows. I would like to trigger a workflow when two contacts in our org have matching email addresses, phone numbers, or names. Any suggestions ...
1
vote
1answer
27 views

CampaignMember AfterUpdate trigger doesn't fire after lead conversion

A Campaign Member After Update trigger should fire after a lead in a campaign is converted, correct? My AfterUpdate trigger is not firing at all in unit testing. I have enabled "Require Validation ...
2
votes
1answer
12 views

Is it possible to launch a flow from an update trigger?

I would like to launch a flow from an update trigger if a field on the object is set to a certain value. Is this possible? I understand that this is possible with the new Lightning capabilities, but ...
0
votes
0answers
33 views

I want to write a trigger between two object without any relationship between them? [closed]

Please give the solution..................... I create new number field on Oppty Object named Total SE Hours. i want populate this field. This field should act similar to a Roll Up Summary field ...
0
votes
1answer
13 views

Do I have to update an object that will be inserted in a before insert/update trigger?

I have a simple question: in a before update/insert trigger, do I manually have to call update on a field that I want to change values in or, since that object is going to be inserted/updated after ...
1
vote
2answers
31 views

Update Closed Opportunity Owner when validation rules/triggers otherwise prevent changes to closed Oppos

Scenario : If I update Account Owner then I want all its Opportunity Owner should be updated with the same, irrespective of its stage(Closed/Open). I want the new Owner Updations to be made on ...
0
votes
0answers
17 views

Insert Trigger not firing when creating record by REST API

I Have (after insert, after update) trigger on Account sObject. When I manually inserting or updating Account trigger fires, also when I updating existing Account via REST API request it fires too. ...
0
votes
1answer
13 views

Add AccountTeamMember and TeamMemberRole when Account Request Object is Converted

Good evening, I have been at the office since 0700 this morning and it is now 2309. I have the majority of all of the trigger and everything situated for my new custom object except for this last ...
-1
votes
0answers
16 views

I need help with createa trigger which will add null to a lookup field. [closed]

I have never written a trigger before, need help. There is lookup field in opportunity object which is related to opportunity to lockup for a duplicate record. I need a trigger to add null to ...
1
vote
1answer
24 views

Getting Recursive Error in with test Class

I'm trying to create an update on the account object when someone creates or updates task. I'm not getting enough test code coverage, and I'm also receiving a recursive error when running the test. ...
1
vote
1answer
17 views

Trigger won't execute with duplicate elements

System.ListException: Before Insert or Upsert list must not have two identically equal elements I get this error on a trigger i'm trying to run, I don't understand why it won't allow this create two ...
0
votes
1answer
21 views

Move EmailMessage's attachments from one Case to another

Here's my use case: Existing logic: When an email with attachment is processed by email2case handler, case (Case A) gets created followed by email message and attachment resides with the email ...
1
vote
1answer
11 views

Changing DateField inserts on a trigger

I'm using a trigger to insert a list of invoices to a contract object, what I want to do is for the iterations of the loop have the Effective_date__c have todays date, then the second iteration be for ...
2
votes
0answers
26 views

How can I create a trigger for when a lead has activity?

When a lead has activity and the lead status is new, that it prompts the user to change to lead status to open.
1
vote
0answers
26 views

Help with Apex code to test a triggers

I've have a child entity - Credit Application that is created on the parent entity - Lead(Appointment). After the child has been created, users go in an update information on the banks used for the ...
0
votes
0answers
21 views

APEX trigger to Update Custom field on Opportunity Splits from Opportunity [closed]

Can anyone help me write an APEX trigger to update a custom field on Opportunity Splits from the associated Opportunity record. It needs to update every time the associated opportunity field is ...
0
votes
1answer
31 views

Update field on Contacts attached to an Opportunity

I have a custom Stage field for Contacts that I'd like to be tied to the Stage field in Opportunities when they're attached via Contact Roles; ideally by updating it with an after-update trigger on ...
0
votes
1answer
21 views

Trigger to make @future callout to the Data.com match API

My company uses data.com premium. We want to create a trigger that will update a lead based on company information since the out-of-the-box functionality only matches based on the lead. (contact). I ...
1
vote
1answer
17 views

Opportunity Event Trigger not working

I'm trying to get a trigger to go off that would create an Event on an Opportunity. The trigger should go off when a box is checked (Create_Calander_Event__c) but the trigger isn't working at the ...
0
votes
1answer
20 views

Restrict creation of duplicate records under parent object based on picklist values

I have Account object as my master and have created a contract object which is a child of Account. I am trying to restrict the duplicate creation of contract records based on pick list values(category ...
1
vote
1answer
34 views

Trigger to match fields in another object

I have 2 custom objects Timecard (pse__Timecard_Header__c) Period (c2g__codaPeriod__c). They don't have relationship. Timecard fields:- Start date (pse__Start_Date__c), Close date ...
0
votes
1answer
22 views

Trigger on Cases, trying to access predefined Case Teams

So I'm trying to create a simple trigger that pulls the list of Case Team Members anytime their updated and copies the list into a custom text field that can be accessed by an email template. trigger ...
0
votes
2answers
48 views

Update Trigger not working

I'm trying to update fields on the opportunity object once the fields are updated on a custom case object. I'm getting the trigger to save, but nothing is happening. Can someone help me with the ...
1
vote
1answer
14 views

Account Trigger with Contact 'for' Loop error

I am relatively new to building Apex Triggers and need some help. Trigger's Purpose: The Account Triggers purpose is to throw an error message if there is no contact associated to the Account upon ...
1
vote
1answer
17 views

Controlling who receives workflow rule email alerts

Here's the scenario: I have set up a community where external users can create cases. When a case is commented on the creator of the case receives an email alert based off of the template I added to ...
0
votes
1answer
33 views

A Trigger that counts the amount of contacts that has Primary Liaison (custom field) populated

I have written a trigger to count the amount of Contacts that has "Primary Liaison" (a custom field) populated and make this count number appear on "# Primary Liaisons" (a custom field on Account). ...
1
vote
1answer
21 views

Lead trigger test fails - newbie alert!

Trying to write a trigger to set a lookup field (Account) on the Lead object, which is based on Account ID as a string that is passed through from an external form)... I have a working trigger (100% ...
1
vote
2answers
110 views

Deployment of a trigger failed due to error, “average test coverage for all Apex Classes and Triggers is 38%…”

Trigger and test class works in Sandbox with 100% code coverage (trigger code listed below) I have checked the following: 1.My code coverage in Production is 98% and Sandbox is 94% according to ...
0
votes
0answers
20 views

Contact's child records transfers

I have few custom child objects (lookup relationship) of Contact. My requirement is if I change the Contact owner from User A to User B, I want the child records of that Contact to be transferred to ...
2
votes
1answer
50 views

Lead Trigger on Import

Hi I have a trigger that runs to dedupe leads that have matching phone numbers(we have 2 phone fields) it works when you go and manually create a lead in Salesforce but when using dataloader.io it ...
0
votes
1answer
39 views

Trigger deployment to production shows “maximum trigger depth exceeded” error

I am deploying a trigger from a sandbox to a production org. During validation it gives me "maximum trigger depth exceeded" error for some other trigger which is not part of the change set. The error ...
0
votes
1answer
20 views

Error: Compile Error: Comparison arguments must be compatible types: Schema.SObjectField, String at line 8 column 113

trigger quantity on OpportunityLineItem (after update){ set<id> lineset= new set<id>(); for(OpportunityLineItem ql: trigger.new){ if((trigger.OldMap.get(ql.id).Quantity!= ...
4
votes
2answers
63 views

Will SFDC manufacture batches from concurrent operations?

So, like all SFDC developers worth his/her salt, I know when writing triggers and other code, we need to bulkify. And I have a pretty good handle on how to do that, so I am not asking about that. ...
1
vote
1answer
24 views

Clone a record in after trigger to update field values

Hi I need to fetch the status field values from the Case History in order to set date/time on when the status was changed to a waiting state. While I was running this code I encountered a run time ...