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

learn more… | top users | synonyms

0
votes
0answers
25 views

Trigger doesn't updates the values using dataloader

Here is my trigger where it updates the Amount and Account fields from opportunity when Opportunity is populated in my custom object OM or it updates Opportunity, Amount and Account if Quote is ...
1
vote
2answers
30 views

How to invoke webservice from trigger without using @future annotation?

The background of the problem is: I am building up a trigger on account which will be triggered when an account is deleted. During execution it will invoke some webservices. But while deleting an ...
1
vote
1answer
30 views

Trigger and Workflow on the same field facing Issues

Hi I have a requirement. I have a custom Checkbox field inside case object say "res__c". When a Email is received then this res__c should be TRUE. And later if the case record is edited, then res__c ...
0
votes
1answer
36 views

Find Duplicate case and close

I shall appreciate ur help. Can anyone help me on this Requirement : Requirement is : 1) Create a case with Subject line (User ) ----First Case 2) Create another case with Same Subject line ...
0
votes
0answers
15 views

Has anybody worked on alternate solution for Account Team Members triggers?

I have a requirement to capture the Account team changes and process them. Unfortunately i can't write a trigger on AccountTeamMember. Is there any alternate solution ?
1
vote
1answer
28 views

Query the cases where case contact = logged in user's contact

for(Case c: [select id from case where ContactId = :UserInfo.getUserId]){ System.debug(c.user.Name); } Am not able to get logged user by case
-2
votes
0answers
14 views

automatic lead generate based on downloads [on hold]

If a limit of 10files are downloaded by user then an automatic lead must be genrated by taking the feild values from user object(i.e. a new lead record must be created by taking values from user ...
0
votes
0answers
17 views

system should automatically identify it as a duplicate case and close the case? [closed]

Can anyone help me out with this requirement ?How to acheive it either through a trigger or Apex class? On case object , we do have a case (Case A)created with subject line : checking for the ...
2
votes
2answers
58 views

ISNEW() Validation rule causing triggers to fail

I created the following validation rule on my contact records: IF( ISNEW()&& ( FormAssembly__c =""&& TEXT(LeadSource)="") && TEXT(Contact_Source_List__c) ="",TRUE,FALSE) I ...
5
votes
2answers
203 views

General trigger bulkification - best practices

A general question asked from time to time on stack exchange is question of trigger bulkification. Therefore I have 2 questions: Which best practices are you using? What is the best way to handle ...
0
votes
1answer
33 views

System.LimitException: Too many future calls: 11 [duplicate]

when i am changing the case owner for more than 10 records in the case list it is throwing the error : Apex trigger LFIQTriggerForCaseChanges caused an unexpected exception, contact your ...
1
vote
2answers
28 views

Trigger to assign open tasks back to specific user when account owner is changed

We have a workflow that creates tasks and assigns them to a specific user when an opportunity is closed. It's salesforce standard behavior that when the account owner is changed, the open tasks are ...
3
votes
1answer
27 views

Future method cannot be called from a future or batch method, Case Trigger with Salesforce for Social

I get the following inside a Case Trigger when I try to call a future method: System.AsyncException: Future method cannot be called from a future or batch method So far this exception ONLY occurs ...
2
votes
1answer
58 views

Too many dml rows exception

I tried to insert records for call__c object which gives this exception Trigger: trigger trgInsertCall on Call__c (after insert) { Set<Id> clientIds = new Set<Id>(); ...
6
votes
2answers
155 views

First trigger: coding - best practices

This is my first production trigger and I'm just wondering if there is a more efficient way to write this code. Basically, if a campaign meets the criteria in the IF statement, I want it to create a ...
2
votes
1answer
36 views

trigger to find change in contact role for an opportunity

We have a scenario where we have contact roles added to an opportunity. We need to know if a contact role for a contact has changed for an opportunity. E.g John doe was an executive sponsor first for ...
1
vote
1answer
16 views

Opportunity Amount field rollup lifecycle

I recently experienced odd behavior where a trigger depending on the the Opportunity.amount field was not picking up the correct values from the amount field even though the context was after update. ...
0
votes
2answers
74 views

Too many DML rows: 10001

I have a trigger which performs an insert operation.One record count is more than 10k.So,Its giving this exception.I have tried batch apex and future method.Its is not working.Any help will be ...
3
votes
1answer
90 views

“Expression cannot be assigned at line -1 column -1”

I'm trying to write an Apex trigger that makes a field on the Contact called Meeting Date equal to the Meeting Date field on the Opportunity. For some reason I'm getting an error saying "Expression ...
3
votes
1answer
113 views

Error:System.LimitException: Apex CPU time limit exceeded

I am getting this error: 'Error:System.LimitException: Apex CPU time limit exceeded' for this simple trigger. The trigger is working just fine. Can anyone tell me if I am doing something wrong in the ...
4
votes
1answer
51 views

First time trigger help - am I being a bad neighbor or going to slow my org down?

Ok, my first trigger question was a bit more complicated (First Time Trigger - correct loop to use question). I'm taking a step back to simplify before I attempt the more complex. Good news my trigger ...
0
votes
2answers
32 views

How do I copy products from one Opportunity to another in apex

So I have a trigger on Order in a certain condition I need to create another opportunity based on the Order's current opportunity. It was pretty straight forward except for getting the products to ...
1
vote
0answers
13 views

Salesforce User Licenses valid for Public Groups

There are lots of different User Licenses in Salesforce. I need to know which ones are valid for Public Groups, since otherwise, the trigger that adds a user to a public group upon creation will ...
2
votes
1answer
55 views

Execute method is not getting called

I have called a batch class from a trigger.In debug log start method is getting called.But execute is not getting called. trigger: trigger trgInsertRecord on Custom_object__c(after insert,after ...
1
vote
2answers
184 views

How to avoid recursive trigger other than the classic 'class w/ static variable' pattern?

How can we avoid trigger get executed again and again (recursive trigger)? One way is to have a class with static variable and have boolean value and check it is true or false and changing the boolean ...
0
votes
0answers
26 views

How to achevie this Scenario by writing a code on case object

Can any one help me out with this requirement .Its very Urgent.I shall Appreciate your help. The User A is sending an Email to E2CP address by keeping User B and C in cc list .The mail is recevied ...
1
vote
1answer
40 views

First Time Trigger - correct loop to use question

I'm creating my first trigger (i'm an admin). It creates a new custom object,StakeholderContact every time a contact is created where 1-4 boxes are checked in the contact record. Right now I’m focused ...
0
votes
1answer
37 views

Can't create account using trigger

What I was originally trying to do (create an account for each lead as it was created): trigger LeadCreateAccount on Lead (Before Insert) { Public List<Account> lstAccts = new ...
0
votes
2answers
41 views

Apex Trigger: Variable does not exist

I am creating a trigger on my Opportunties object which on update alters some fields in the object, I also need this to update a related object called RBCO__c. The foreign key used to reference the ...
0
votes
0answers
42 views

Insert contact statement in test class is causing 0% code coverage

I've written a simple trigger to prevent duplication of a lead based on existing leads and contacts. My test has 90% code coverage based on the tests that I've written to prevent lead duplication. ...
0
votes
1answer
28 views

How do I write a test class for the below trigger? [closed]

I have just created the below trigger that is deigned to create a new custom object record(Services) when a custom date field (Service_Date__c) on another custom object (Unit)is equal to "This Month". ...
1
vote
1answer
41 views

Creating and updating a custom field for a Campaign Member

I am trying to send out an email whenever a campaign member's status is updated. I have the email side of it set up and working and am able to call that class from a trigger. Since I do not want an ...
3
votes
1answer
45 views

how to use Sobject in trigger

I have a scenario where the three objects trigger have relatively same logic for beforeInsert and beforeUpdate. Even the fields of these objects that i use in trigger are same. this is my below code. ...
1
vote
2answers
73 views

Error in loop iteration: 'Loop must iterate over a collection type'

Please find my code here. trigger PM1 on Account (after update) { List<Product_Metrics_vod__c> toDelete = new List<Product_Metrics_vod__c>(); set<id> ...
0
votes
1answer
37 views

Not Queryable field issue

I have to query on a non-queryable field here. Can someone suggest a workaround for this? Please find my code below. trigger PM on Account (after update) { for ( Account acc : Trigger.New ) { ...
1
vote
2answers
100 views

After update trigger issue

Please find my code below. trigger PM on Account (after update) { for ( Account acc : Trigger.New ) { List<Product_Metrics_vod__c> listCon = [Select ...
0
votes
1answer
17 views

Email to Case requirement

Email to Case Trigger:- Is it possible to auto populate account and contact fields in case when email id is existed in contacts
0
votes
0answers
18 views

Copy Case and its field updates to a custom object

I have a requirement to create a case record in a custom object when a case is created. Also, when a case is updated I want the update to flow into the custom object too and vice versa. How do I ...
1
vote
2answers
34 views

Query task in Lead conversion.?

When i am querying lead in Lead conversion trigger..My task query is returning null even there are task records associated with Lead object..I even try to hard-code query still its returning empty ...
1
vote
1answer
28 views

Apex Triggers to solve my Opps and Contracts problem - The Other Half

So, thanks to @BarCotter I have managed to get the first half of my problem sorted. I now have an Apex trigger to create a record in a custom object upon creation of an opportunity. What I need to do ...
1
vote
1answer
17 views

Populating Account record from Lead in an Account before insert trigger

There are lot of discussions on Lead conversion. I'd just need to know is there any possibility to track whether the Account is being created upon a Lead conversion and if collecting information of ...
1
vote
3answers
40 views

Checking a Custom Field if Opportunity Stage has changed

i can't figure it out where i did mistake..any help would be appreciated.. trigger oppiswonchec on Opportunity (before update) { for(opportunity opp : trigger.new){ opportunity oppold = ...
1
vote
1answer
22 views

After Insert Trigger & WFR Field Update

This is a fresher question. I am trying to understand the mechanics of SF Order of execution. Let us assume that there is a custom object "Alpha". "Alpha" has a custom field "FAlpha". "FAlpha" is ...
2
votes
1answer
30 views

trigger questions

I've few questions on triggers In an insert trigger, Can I update a field and use that field in where clause of SOQL Query? so same transaction is updating and querying field. difference between ...
2
votes
1answer
91 views

Help with trigger defaulting multi-select picklist fields

I'm fairly new to coding and my admin has asked me to create a couple of triggers to update a multi-select picklist for our Opportunity page or maybe I could combine them into one. I have created the ...
1
vote
1answer
28 views

Change status of lead using Trigger?

I need to write Trigger when the Status of a Lead changes ? I'm wondering whether this will work or not . Thanks in advance.
5
votes
1answer
93 views

Too many SOQL queries error when converting Leads

I am new here and have no coding experience whatsoever. I am a Salesforce admin with 3 years experience. Before I started at my current company, they hired a consultant to create some APEX triggers. ...
1
vote
2answers
31 views

Select statement returns no data in testmethod but does return data in execute anonymous

I have this select statement that fetches ID and a string from a custom object and creates a map using them. For some reason, when I run test, the select statement doesn't return any values. When I ...
4
votes
1answer
22 views

Inserting a child record using a trigger based on an external ID

I have a trigger that inserts a new child record (Training Session) below Training Module using a third object (Scheduler). Training Module contains an external ID called Training_Module_ID, but when ...
1
vote
1answer
29 views

Copy Rich text area field content to text area field

Can anyone give me the code for copy rich text area content to Text area field after save. The text area should not contain any html tags in it.