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

learn more… | top users | synonyms

0
votes
0answers
16 views

How to restict user from deleting activity history for all the objects [on hold]

Remove ability to delete activity history and notes and attachments from all the objects and display Custom message
1
vote
0answers
17 views

writing a trigger to mention reporter of a case

i have a tough time with Salesforce. How do i go about writing a trigger to specify the person who created the case as the reporter in the "reported by" field? this is code i have written trigger ...
0
votes
1answer
23 views

System.ListException: Duplicate id in list in Trigger

I get System.ListException: Duplicate id in list error in my trigger code. i haven't used single list in code. i used Set and Map in all places. Following is my trigger. trigger ...
1
vote
1answer
29 views

Rollup Summary to Calculate Weighted Average

As a child (master-detail) to my opportunity object, I have a custom object 'Transactions'. Each transaction has its own interest rate, transaction date, and amount. The opportunity has a term (in ...
0
votes
0answers
13 views

Invalid field isActive for SObject User in trigger (before update)

Can you please help me figure out why is the following code giving this error: 'UserBU : UserBU: execution of BeforeUpdate caused by: line 9, column 21: Invalid field isActive for SObject User'. The ...
0
votes
0answers
9 views

Able to perform DML operation on Read only object from trigger running with sharing

I have a trigger which runs with sharing. All I am doing in this class is updating or inserting another sObject on afterInsert or afterUpdate. Trigger is running in system context Profile/user used ...
0
votes
0answers
15 views

How to prevent email triggering goes to Enduser for adding new field to case page [on hold]

I need to create one new field in case page, if i create new field on case page the Emails goes to End users,How to prevent those emails to End user.,Thanks in advance
1
vote
3answers
35 views

Unit test for trigger SOQL query that is uncovered

I'm having an issue finishing up my unit test, and I think it is related to the SOQL query in my trigger. The trigger itself checks to see, upon Lead creation, if a Contact exists with a matching ...
0
votes
1answer
16 views

Trigger to Update picklist value based child records picklist value

I have two custom objects Sale__c and Project__c. Both Sale__c and Project__c have different status in a picklist. Sale__c status is broken into two picklist Status__c and Status Detail__c ...
2
votes
2answers
26 views

Code Coverage 70% but I can't figure out how to make it to 75% or 100%

I am new to triggers. I will admit that but this is my first trigger and I really want it to work! My problem is that I still am receiving only 70% Code Coverage when the trigger works fine in ...
2
votes
1answer
15 views

Chatter Answers trigger not available in Eclipse - no access to trigger I know is there

I need to correct a known issue with Chatter Answers and one of the triggers that needs modification (chatter_answers_question_escalation_to_case_trigger) is unavailabe in Eclipse, i.e. I can't access ...
1
vote
1answer
26 views

Accessing lookup fields within trigger context

I have a custom object Customer with a few fields. One of the fields is a Lookup field that refers to a standard object Account. I'm writing a trigger that should fire before each insert/update. The ...
0
votes
0answers
19 views

How to write a trigger to send an email notification to author whenever a thumbs up/ down voting or a comment is given on a Published content?

How to write a trigger to send an email notification to author / designate whenever a thumbs up /thumbs down voting is done on a Published content? This following trigger doesnt work.It doesnt fire ...
0
votes
0answers
9 views

How to write a trigger to send an email notification to author / designate whenever a thumbs up /thumbs down voting is done on a Published content? [duplicate]

How to write a trigger to send an email notification to author / designate whenever a thumbs up /thumbs down voting is done on a Published content? This following trigger doesnt work.It doesnt fire ...
0
votes
1answer
29 views

APEX trigger error on Account Level Only

I'm new to coding and my developer friend and I have this APEX trigger to update a custom field on opportunities, based on recently created tasks. However, we can't create a task on the account ...
2
votes
0answers
28 views

Code coverage is 70% and I get a DUPLICATE_VALUE issue

Code coverage is 70% and when I dive into the problems I get a duplicate error. Please help I am new to writing triggers. Thank you ahead of time! Problem on several Lines Message: [object ...
0
votes
1answer
18 views

increment in number of calls field when task is completed through trigger?

trigger totalnumberofcalls on Task (after update) { Set<id> leadid = new set<id>(); for(task t:trigger.new){ if(t.Type=='Call' && t.Status=='Completed'){ ...
1
vote
0answers
17 views

Need to send a pdf attachment from trigger when a update happed

I have created a trigger on my invoice object when a update happen I want to send a email from my trigger with a pdf attachment. But when I try to update my record I am getting an error. ...
1
vote
1answer
22 views

How can you ensure a feedcomment trigger only applies for cases?

I apologize if this is turns out to be ridiculously easy. I've managed to configure a feedcomment trigger that behaves as desired except for a big point: we need it to either: - Only apply within ...
2
votes
0answers
42 views

No test coverage on after insert trigger

I can't quite tell why code coverage is saying that there are 0 lines covered. My objective is that every time an Award is inserted, an Award Judging Criterion is inserted with a link to the Award. ...
3
votes
2answers
68 views

List Exception Duplicate id error

I get an error in my trigger when i tried to insert bulk data from data loader. Error is : ERROR: SubscriberUpdateTrigger: execution of AfterInsertcaused by: System.ListException: Duplicate id ...
1
vote
3answers
97 views

Problem with System.assertequals in test class code

I have below trigger code : trigger updateopportunities on Account(after update) { Set<Id> accountIds = new Set<Id>(); for(Account ac : Trigger.new) { ...
0
votes
1answer
11 views

Error: Compile Error: Loop variable must be of type SOBJECT:Account

When I try to write a trigger on my account object I am getting an error. Error: Compile Error: Loop variable must be of type SOBJECT:Account at line 3 column 17 My code : trigger ...
0
votes
1answer
24 views

delete trigger not removing last value

I have a trigger that copies values from child records to a field on the parent record. The trigger runs on insert, update and delete. The problem is occurring when I try and delete the last child ...
2
votes
1answer
37 views

Cannot use @istest in Apex Triggers

I'm brand new to Apex/Salesforce development, and am attempting to create some Apex triggers and tests. Each time I try to add a new class, when I start it with @IsTest I am unable to save it. I see ...
0
votes
1answer
17 views

Confirmation Dialog to Run Trigger on a picklist.

I have a pick-list on accounts that when a certain stage is selected and saved, all oops are cancelled (via trigger). Is there a way to add a confirmation after selecting the stage from the pick-list ...
1
vote
2answers
14 views

Apex Managed Sharing Rule to share master object after insert of detail object

I am developing a team model like Opportunity Teams for a custom object (e.g. CustomObject). I have developed the necessary objects and fields. I have also developed a Visualforce page to create the ...
0
votes
1answer
17 views

Lead assignment round robin based on lead source

i want to implement round robin for lead assignment but it should only work based on a lead source value . only should run when lead source is equal to facebook . can any one suggest me what would ...
0
votes
2answers
23 views

help in multiplying values in Two Fields & display in 3rd Field in trigger

help in multiplying values in Two Fields & display in 3rd Field Request help in multiplying values in Two Fields (UnitPrice__c & QuantitySold__c} & display the value in edit mode in 3rd ...
0
votes
0answers
12 views

Task are not getting updated

Standard salesforce functionality: when Parents Owner gets change related tasks Assignee gets updated with parents Owner. In my case: I have after update trigger on account in which when account owner ...
6
votes
2answers
152 views

Are inactive triggers counted against test coverage?

We are in process of deploying a project to PROD and found that test coverage is coming up less then 75%. There are some triggers we have merged into single trigger. Question is: whether the ...
4
votes
1answer
102 views

Why does this call to Trigger keySet() throw a null pointer exception?

I have a simple trigger like: trigger littleTrigger on Custom__c (before insert) { Set<Id> idSet = Trigger.newMap.keySet(); //Some stuff } Why could the second line throw a null ...
6
votes
1answer
74 views
+100

Checking 'Correct' Previous value method in Trigger design best practice

One of the most common questions on this forum is around trigger recursion. There are a few standard ways to prevent recursion. My method of choice when it comes to checking for field changes, is ...
0
votes
3answers
51 views

System.LimitException: Too Many SOQL Queries: 101 in Trigger

Following is my trigger I get the following error System.LimitException: Too Many SOQL Queries: 101 in Trigger Here is my trigger trigger SubscriberUpdateTrigger on Subscriber__c (after Insert, ...
0
votes
2answers
41 views

scenario for recursive trigger

Can any one out here give me a scenario for recursive trigger. Why don't we able to control the trigger in the same place. Why do we go for a class under every trigger Context. Please provide me a ...
3
votes
2answers
32 views

Is there a better way of creating a list of records from the lookup of an object?

For example I have the following code: Set<ID> ReferralID = new Set<ID>(); List<Account> Referrals_List = new List<Account>(); // Create a set of Id's of the Referrer ...
0
votes
1answer
26 views

Populate case clone field with email body - EmailMessage Trigger

This will be my first Apex trigger. I want to create a new case (by cloning another) when an email is sent to a case with Status = Closed. I've taken some code from a previous Stack Exchange thread to ...
0
votes
3answers
32 views

How can field auto update over time?

I have a simple PTO(Paid Time Off) object, in which I want certain fields to automatically add increments over time evaluated by the beginning of the Calendar Year. So for example, if my beginning ...
2
votes
0answers
11 views

Database.DMLOptions - How to prevent Chatter Group Auto-Follow trigger from generating email

Currently I have a trigger which auto-follows specific groups in our organization when a new user is brought onboard. The auto-follow trigger feature works great! However, we have quite a few groups ...
4
votes
3answers
240 views

Are trigger frameworks ALWAYS necessary?

When working on a small org with a few simple triggers, I feel that using a trigger framework easily bloats the code base and a bit overkill as well. I admit this is short-sighted as requirements may ...
0
votes
0answers
7 views

Updation of Forecast Twice ,once on opportunity value and second time at forecast values

I get stuck in a scenario. i am updating forecast on basis of some opportunity field values and then again i am updating forecast on some forecast field value for same opportunity.i have tried to ...
1
vote
2answers
56 views

Apex Trigger to update Account field when Case field is updated

I am struggling to come up with a trigger to update an Account field (Last Survey Sent) when the same field gets inserted or updated on the Case (Last Survey Sent). I am unable to do this via ...
1
vote
0answers
16 views

Cases with Same Subject line added with a Prefix as :RE is not getting identified as a duplicate case

Cases with Same Subject line added with a Prefix as :RE is not getting identified as a duplicate case and getting it closed by adding its case comment to the Existing case which is Open. The trigger ...
0
votes
1answer
26 views

Trigger: Updating Hyperlink Field on Attachment Parent Record

I am currently working on an Inforce based integration between Salesforce and InforLN. As part of this there are custom invoice objects: InForceEW__invoice__c I am looking to attach PDF copies of ...
3
votes
1answer
51 views

Which DML Events Cause Trigger Recursion

I am curious, besides the UPDATE DML event causing trigger recursion (an update causing another update due to a field update), what other scenarios can result in trigger recursion. I would like to ...
3
votes
2answers
59 views

Trigger to update opportunity stage based on Account Status

I have a trigger that updates/ inserts opportunities when the account is created. This was implemented by a third party. Now I would like to update the opportunities to Cancelled when the Account ...
2
votes
1answer
29 views

How to count OpportunityLineItems left in an after delete OpportunityLineItems

I have a trigger on the OpportunityLineItem acting after delete. From that trigger, I want to query all the Opportunities associated to the OpportunityLineItems deleted to see if they still have other ...
1
vote
1answer
33 views

Tracking deliverables for different donation levels

I'm working on tracking deliverables for a non-profit. When a donation is made at a particular level, specific benefits are included. For example, a donation of $100 is Level 1, which includes A, B ...
5
votes
1answer
66 views

How to test @future methods with setup objects and avoid MIXED_DML_OPERATION

I’m in a situation where I have to use a future method to avoid MIXED_DML_OPERATION error. I have a trigger that runs after INSERT on USER and creates a custom object X. They are in 1:1 relation. ...
2
votes
1answer
53 views

HttpResponse StatusCode=200, but 3rd party request (Pardot) not made

ObJective: I am attempting to create a new prospect in Pardot when a lead that had no email gets updated with an email (Pardot will sync accounts but until the lead email exist there is no prospect to ...