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

learn more… | top users | synonyms

0
votes
1answer
26 views

how to overcome the recursive error in trigger?

I have written the trigger on service object.but i got error,i know updating the record on same object.how to overcome this type of error ? my error is Like:: Error:Apex trigger updateaccounting ...
0
votes
1answer
14 views

Need to restrict the email notifications to only those tasks created by the specific profiles

For The above requirement how to restricted email notification for specific profiles.For that i have written a trigger mentioned the below but that code is not working as expected. could any one help ...
3
votes
2answers
47 views

Will Trigger and Workflow get fired while using Bulk API

I am trying to upsert records in Account using Bulk API. After upserting records I need to update some of the custom field values to standard field values using trigger or workflow. Is it possible ??? ...
0
votes
1answer
23 views

Delete Contact Trigger after insert failing

I wrote a really simple trigger on Contact After Insert which isn't working as expected. The expected behaviour would be to delete contacts created from Leads converted that had the field ...
1
vote
2answers
37 views

Error with Map in Apex Trigger

I have 2 custom objects (Workload_Unit_Score__c, Agreement_Title__c). The WLU_combination_Value__C and Score__c fields are on both objects. I want a trigger on the Agreement_Title__c object that, ...
0
votes
0answers
17 views

Retrieve Product2 return null when query outside the loop

I have trigger on before insert on Opportunity Line Item.It need to query the Product2 field. This is the current code; for(OpportunityLineItem oli : newList) { if(oli.automatedCreated==false) ...
0
votes
1answer
23 views

Trigger to Populate Field on Record when Matching Value is Found

So I have two custom objects: The Workload_Unit_Score__c object is a mapping table, with a reference field (WLU_Combination_Value__c) and a value (Score__c) for each row reference. We receive ...
1
vote
1answer
19 views

Cannot populate field value on new record with trigger

I am trying to write a simple trigger that will populate field values on a newly created record. I'm using standard objects: Account and Opportunity I have two custom fields on the Account object ...
0
votes
3answers
20 views

Deploying trigger error

I get this error 7 times for 7 different classes. System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgr_DocoSilentMode: ...
1
vote
3answers
39 views

Need help in my Trigger on object Opportunity

I have a custom text field on Opportunity object by the name 'Opportunity Status' . Now when a Task is Created/Updated then I want my trigger to consider the top most 'Task' field 'Call Result' value ...
2
votes
1answer
127 views

Clone record issue

I am facing a problem regarding Clone of record. I have an apex page as detail page of Survey__c object. There is a clone button to create new record from existing one via an apex class. Now I am not ...
2
votes
3answers
72 views

opportunity to alert the user when an Opportunity is being closed with no Opportunity line items in it

I am new in salesforce and I have a requirement to create a trigger on Opportunity to alert the user when an Opportunity is being closed with no Opportunity line items in it.
1
vote
1answer
11 views

Update Account Lookup field by comparing custom field text, looking for exact match

Newbie here, just starting to learn how to code via trailhead and anything I can find online, while also trying to solve org problems in the real world of salesforce CRM, so am hoping someone can help ...
-2
votes
2answers
25 views

Salesforce update trigger error

i need help as i am new to apex and trigger. i have created the below trigger to update the amount of existing record but it is giving me error trigger discount on platform__c (after update) { ...
1
vote
1answer
31 views

Global variable isn't updating on my Apex Trigger

During a merge of leads I'm trying to combine the descriptions from the old leads. In the Trigger.isDelete section, my variable newLeadDescription variable receives all the old descriptions added ...
0
votes
1answer
20 views

How to automatically update a CAMPAIGN field once LEAD has been linked to CAMPAIGN

Sometime ago, I was able to solve a problem of updating a CAMPAIGN field once LEAD is created or edited with help from here [ Want to update a Campaign field if Lead is created or updated ]. But ...
2
votes
2answers
67 views

Duplicate Variable Error

Can you guys please help me out here Error: Compile Error: Duplicate variable: a at line 24 column 18 trigger accountfuels on lead (after insert){ if(trigger.isinsert) { ...
1
vote
1answer
28 views

Comparing a text with a attachment body

I want to compare a text with a attachment that is added to a custom object. For example, check if the word "Test" is placed in the attachment body.
0
votes
2answers
34 views

DML operation on setup object is not permitted after you have updated a non-setup object [duplicate]

This trigger fires after inserting a User. It will create a new record on Leave_Balance_Transaction__c but Im encountering this error: Review all error messages below to correct your data. Apex ...
0
votes
0answers
22 views

Insert, update records based on same level objects [on hold]

I have Account object also AccountTeamMember. Also I have created one Custom object name Account Team. Fields are User, Account Lookup and one custom picklist for storing roles. I want insert, update, ...
1
vote
0answers
37 views

Trigger on Child record to update Parent Record and to create new Child records ( same ) [on hold]

I have been trying to come up with the pattern in which i need to handle the below scenario ( considering recursion ). On Insertion of Child Record ( Object - B ) i need to update parent record ( ...
0
votes
2answers
27 views

Case creation error in sandbox. Apex error?

Hi All, I recently refreshed my sandbox for the first time and now im suddenly getting this error when i try to create a new case. (dont know if issue is related to the refresh) we call cases ...
2
votes
3answers
58 views

How to update an Account field using a Trigger on Account

trigger AccountStatusOverrideTrigger on Account (before insert, before update, before delete) { Set<Id> accountIds = new Set<Id>(); for (Account acc : Trigger.new) { ...
2
votes
1answer
71 views

Task email notofications

If we assign a task to someone else, we can get an automated notice when the task is completed. For that i have written one trigger mentioned below that trigger is working fine but email is being ...
0
votes
2answers
18 views

How can I check if a PICKLIST value is not selected?

for(Account a : accounts) { noOfOpp = a.Opportunities.size(); if( isEmpty(a.Client_Account_Status_Override__c) == true ) { if(noOfActiveOpp > 0) { ...
0
votes
1answer
34 views

System.LimitException: Apex CPU time limit exceeded while updating through Data loader

Can any one help me out with this error CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:CMAccountAssignmentTrigger: System.LimitException: Apex CPU time limit exceeded While updating industry field ...
2
votes
2answers
86 views

Can we display warning message from Trigger

I am using custom Object, I need a warning message on Detail Page, Is there anyway?
2
votes
1answer
26 views

Would updating children records at the same time cause “UNABLE_TO_LOCK_ROW” error? How can I avoid this?

I have 3 objects with the below relationship: One Account(Master) Opportunity(Detail) Custom__c(Parent) (lookup on opportunity) Opportunity(Child) Here's the scenario: I have 1 ...
3
votes
0answers
41 views

Is there a trigger I can use to catch changes to a user's e-mail signature?

I'm trying to write an Apex trigger that fires when a user changes his or her e-mail signature through Personal Setup -> Email -> My Email Settings. Because the signature is stored in User.Signature, ...
1
vote
1answer
15 views

Convert PST to current loggedin user locale time

I have a datetime field that is populated by the user in pst timezone.I want to convert this field to the local timezone of the lead owner.How can i achieve this?I have tried this so far i am getting ...
1
vote
0answers
17 views

Preventing duplicate records from being processed by trigger

Scenario:(I have translated it to accounts & contacts, actually are custom objs)- I have decided that the contacts with the same name under are account are duplicated. Hence I have written a ...
0
votes
0answers
25 views

No of Business Hours between Dates with current logged user time zone

I am looking at requirement where we have a start time and an end time on a lead for an action to take place.How can we find out the no of business hours between the start time and end time excluding ...
0
votes
1answer
29 views

Exception Error for Trigger

I have this trigger where it adds new user to chatter group but it throws exceptions everytime when i reset the password or when i deactivate any user, how can i update the trigger to not throw any ...
0
votes
1answer
29 views

Have a trigger fire “Across” a junction object [closed]

I have three objects in a many to many relationship. ObjectOne, ObjectTwo and they are joined by the junction Object, ObjectMiddle. I have a field on ObjectOne that has a text field that holds a JSON ...
1
vote
1answer
19 views

Apex - Task.What.Type

Need a little help. I can't figure out the correct syntax to utilize Task What.Type in my trigger. Can someone tell me what I am doing wrong? trigger ININRelatedToFix on Task (after Insert, after ...
1
vote
1answer
22 views

Compile Error: Illegal assignment from Opportunity to Date - Trigger to update Oppor closedate on oppor line item

trigger CloseDate on Opportunity (after insert, after update) { Map<Id, Opportunity> CloseDate = new Map<Id, Opportunity>(); for (Opportunity O: Trigger.new) ...
3
votes
1answer
39 views

Prevent Account Deletion based on Child Contact Status?

I have a requirement in which when click on delete button on the account it should allow you to delete only when its related contact status is inactive. I have written the following code which gives ...
3
votes
1answer
31 views

Auto populate user to custom object on a trigger

I'm having some issues with some code I've adapted to work for my instance that was posted by @Brian Mansfield. We have invoices pushed into a custom object and they link through to accounts fine, ...
0
votes
0answers
25 views

How to write a trigger :when task is completed email should be sending to task owner based on the Task Record type selection [closed]

How to write a trigger :when task is completed email should be sending to task owner based on the Task Record type selection. Could any one please help me on this Thanks in Advance.
0
votes
1answer
35 views

How to display a message on a VF page depending upon the value of a variable in an trigger?

I have an after insert after update Trigger which is responsible for calculating value of a variable. Depending upon the calculated value, I have to display a message to user on a VF page( not error ...
3
votes
1answer
31 views

Create test Class for RESTFUL WEB SERVICE CALLOUT

Good day everyone, I am trying to create a restful web service callout everytime a contact in created,updated or deleted. I used this link as my reference ...
0
votes
1answer
26 views

Where and when do we need to use api names in triggers?

Where and when do we need to use API Names in Apex Triggers?
0
votes
1answer
20 views

Converting Lead to custom object

I'm working on creating a button on the lead object that will insert the fields into a custom object. I can't get my trigger to work, and I'm not sure what I'm doing wrong. Here is the code for the ...
1
vote
2answers
54 views

Trigger will not fire, picklist value always returns null

In an apex "before update" trigger, I have a conditional statement based on a picklist value. However, this conditional statement never fires because the picklist value always returns null. trigger ...
0
votes
1answer
14 views

Update Lookup Field with Text ID

I have what I think is a very simple request, but I'm struggling with it.  I have a custom field on the Case object called Account ID, which is a text field.  I also have a field called Primary ...
0
votes
1answer
19 views

Apex Trigger to create a contract from Asset

I am currently in the process of trying to get a trigger that will create a new contract each time an asset is created (within a certain product family) When our salesforce was setup our consultant ...
0
votes
0answers
26 views

Need help with my test class

I have updated my triggers with few lines of code and a custom setting which will allow me to dynamically activate/inactivate the trigger in production. But now the issue is that my test class is ...
0
votes
2answers
67 views

how to solve this “System.ListException: Duplicate id in list in Trigger”?

In Product Object ,one record say "A" Rfleet_C2G ParantProduct field contains some value"DZ-Captur".If the value is same as the name field "DZ-Captur" in another record say "B".then will take that ...
0
votes
1answer
24 views

At what point are attachments saved to an object - need to pick them up in trigger

I have a custom object which is created via an online form. It is possible to add attachments and this all works fine - the object is saved and so are the attachments. In the 'after insert' trigger ...
1
vote
2answers
21 views

Updating Previous Owner field on Case object

I have a custom field called Previous_Owner__c on the standard Case object. Every time the Owner is changed, I need to update this field with the previous owner's value. I have written a before update ...