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

learn more… | top users | synonyms

0
votes
1answer
12 views

how to handle unDelete event in trigger(check duplicate email)

I have created trigger to check duplicate Email found then record will not save. this is working fine on before insert and before update. But My Question is suppose i have a record who have Email ID ...
2
votes
1answer
32 views

Apex Trigger to create Opportunity Contact Role based on Contact Lookup field

I have created the following Apex trigger that will create, update and delete Opportunity Contact Roles based on a Contact Lookup field placed on the Opportunity. Everything works great currently. I ...
0
votes
0answers
15 views

Send email using template to queuemembers

I need to send an email to queuemembers using emailtemplate retrieve from queue in apex .currently i am using body in apex for(User u:[SELECT Email FROM User WHERE Id IN (SELECT UserOrGroupId FROM ...
0
votes
1answer
26 views

Comparing values using maps

There is One Account to Many Opportunities. There is Amount field in Opportunity. I am trying to find Opportunity with Minimum Amount against Account Id. I need a map like this Map<Accid,...
0
votes
0answers
19 views

Trigger to Pull related contact's details on Task page when new task creates

I have a requirement. Contact related to Task, I need to pull his functional role (custom field) on Task page layout. So whenever I create or edit a Task and relate with any contact so his/her ...
1
vote
1answer
20 views

Inactive Trigger Test Code Question for potential solution

I was reading this: Are inactive triggers counted against test coverage? And I had an idea pop into my head: Can I cover several apex triggers, using a single test function, if they all contain the ...
1
vote
2answers
31 views

Send email to queue members using apex

I need to send email to queue members of queue on update case record based on some conditions. There are multiple queues and on case there is one field based on that I need to send email... How can I ...
2
votes
3answers
31 views

Trigger to update the owner of child record to the owner of parent record (look up relationship)

I have a custom object called "Recurring Storage Revenue". This object is populated via integration so the owner of the revenue records is the system user. I need to build a trigger so that the owner ...
0
votes
1answer
23 views

Prevent task deletion by anyone other than task creator

I need to create a trigger that will prevent the deletion of a task by anyone other than the creator. I don't know about writing code so I'm hoping someone can help me out with this. It would be an ...
0
votes
0answers
13 views

Send mail to Queue members using Apex [on hold]

I have multiple Queues and I need to send emails to specific queuemembers on update of case based on some conditions. I am not updating Case Owner,Only need to send mail to queue members. Please ...
-3
votes
1answer
26 views

How can we run a class [on hold]

I have one class that is sending emails to users. That class needs to execute after update a records. But the i am not receiving emails. Now i need check debugs of that class.
0
votes
1answer
20 views

Send Email to Multiple Account Contacts

I have a scenario where i need to send email to multiple contacts. Under account contact we separate some contact with type - 'Approvers' and one account can have multiple contacts with type ...
0
votes
1answer
19 views

Calculate Last task and Last Event age on Opportunity page

I have an issue. I have last activity age by using (Today()-Lastactivityage) to calculate last activity age. But I want to segregate it as last task age and last Event age. I have two custom field on ...
1
vote
1answer
97 views

Method does not exist or incorrect signature: (List<Object__c>, Map<Id,Object__c>)

I am trying to query all modified records from one custom Object and sending one email with all modified records. Where i getting error with trigger handler public static void ...
3
votes
1answer
58 views

Disable the trigger in manage package

My client have installed a managed package in his salesforce org. Now he want to disable some of the trigger in this manages package. From my researcher I am able to understand that the trigger can ...
2
votes
2answers
63 views

Initial term of field expression must be a concrete SObject error at confusing point

I am writing a SObject generating class for unit test. Here is my code: public class Uth_Integration_Obj extends Uth_Sobject { public String status; public String sf_id; public String ...
0
votes
2answers
30 views

Status scenario trigger

I am new to SFDC. I want a trigger on an object. The developing scenario is given below. The object has a custom pick list field called Status__c with values "pending", "processing" and "Approved". ...
-1
votes
0answers
18 views

How to Insert, update and delete operations using trigger using two different objects? [on hold]

When record is insert in Object 1, the same record automatically insert in to object 2 and similarly we need to update and delete operations using trigger. Please give me any example.
0
votes
0answers
16 views

Workflow Working on Page but not in test class

S1SD1__c, S1SD2__c and S1SD3__c these are three checkbox and StageName is picklist on Opportunity object when stagename is Stage 1 - Qualified and all three checkbox are checked and when click on ...
0
votes
1answer
31 views

Trigger to Pull related contact designation on Task page when tesk create or edit

I have a requirement. Contact related to Task, I need to pull his functional role ( custom field) on Activity page layout. So whenever I create or edit an activity and relate with ant contact so his/...
1
vote
1answer
28 views

How to update field on parent contact record

In the following trigger, it gets child records of a custom object based on the contact id of a record that was just saved. I need to update their data into a field on the parent contact record. The ...
0
votes
1answer
27 views

Task trigger creating multiple records

I'm trying to override the standard log a call functionality but with some changes. When creating a log a call record it will be possible to select multiple users and multiple contacts. I've created ...
0
votes
2answers
31 views

How to get records for given contact id in this case?

I created a custom object named Related_Staff_Positions which is a child lookup to the contact object. Whenever one saves a new record, in a trigger I wish to get all records in the ...
0
votes
1answer
25 views

Getting error when assigning a SOQL query to list variable

I am getting this error "unexpected token: 'name'" from this piece in my trigger. Why? trigger trgr_Related_Staff_Position on Related_Staff_Positions__c (after insert,after update,after delete) { ...
0
votes
0answers
23 views

I have a custom object like lead,i convert this lead into account,contact after convert object record i need to delete this record

{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/37.0/apex.js")} var accnt = new sforce.SObject("Account"); //caprturing Mylead id for deletion after insertion of ...
0
votes
0answers
28 views

Getting error in Test class [on hold]

I have a trigger to update custom function field on event. Contact related to activity, I need to pull his functional role ( custom field) on Activity page layout. So whenever I create an activity and ...
0
votes
3answers
26 views

Translating Data using Apex Triggers

I am trying to import a database that have numbers in the picklist value. (1,2,3,4,5..etc) However, in the user-end, they should see different set of values, for example ( 1.-> Partner 2.->LLC ...
1
vote
1answer
33 views

Trigger to Pull related contact designation on Activity page

I have a requirement. Contact related to activity, I need to pull his functional role ( custom field) on Activity page layout. So whenever I create an activity and relate with ant contact so his/her ...
0
votes
3answers
18 views

I wanna create a trigger that queries the latest task (based on created/modified date) on Account

I wanna create a trigger that queries the latest task (based on created/modified date) on Account. It works fine on AfterInsert,but I wanna have After Update functionality as well. Can anyone help My ...
2
votes
1answer
23 views

How to prevent package triggers clashing with local triggers?

Assume there's a trigger on before-update of Account that sets Account.FIELD to "Value 1". A custom setting determines if it can run. This trigger along with related unit tests is included in a ...
1
vote
2answers
50 views

record not created on before insert

if(Trigger.IsBefore &&(Trigger.IsInsert||Trigger.IsUpdate)) { for(Account acc:Trigger.New) { if(acc.Special_Customer__c == 'VIP' && acc.Customer_Status__c == 'Customer') { ...
-4
votes
0answers
14 views

Test Class for the below trigger [closed]

trigger EmailAfterDelete on Account(after delete) { Messaging.reserveSingleEmailCapacity(trigger.size); List<Messaging.SingleEmailMessage> emails = new List<Messaging....
0
votes
2answers
27 views

Which will be better for updating millions of records either trigger or batch class

I need to updated millions of records which is of currency type.So i need to write business logic for the same.So shall i go with trigger or Batch class. In the case of a trigger, every time an ...
1
vote
2answers
42 views

workaround sql govenor limits

I am building this program that will generate numbers in fields based off of other records in that object. As such, queries will be needed. I have the program to the point where it will update when ...
1
vote
1answer
24 views

What to do when Formula Field is too big to compile

So I am having a problem. I already have written a formula for a field that I would wish to calculate. But the problem is that the I can't add any more code to that Formula field because then it gives ...
0
votes
3answers
37 views

How do I update one field for duplicate checking when a new lead is inserted? [closed]

trigger lead_duplicate_checker on Lead (before update) { Map<String, Lead> leadMap= new Map<String, Lead> ([SELECT email, Id FROM lead]); Map<String, Lead> duplicateLeadMap = new ...
0
votes
0answers
29 views

Arithmetic expressions must use numeric arguments

if(AcctIds.size() > 0) { listAcct = [SELECT Id, Count_of_Contact__c FROM Account WHERE Id IN : AcctIds]; for(Account acct : listAcct) { Integer noOfConts = 0; ...
0
votes
1answer
41 views

OppId need to be populated on case

When an Opportunity of Record Type='Execute' is closed a) Case of Record Type ='order management' should be created, routed to OM queue and OppId need to be populated on case. b) When OM member ...
3
votes
1answer
42 views

How can i bulkify this trigger? Or is there any other way i can write this trigger in better way?

trigger MapAccountSource on Opportunity (after insert,after update) { Set<Id> opportunities_id = new Set<Id>(); if(checkRecursive.runOnce()) //Make sure After update trigger ...
1
vote
0answers
43 views

Trigger to update parent's field

I have a requirement: 1) Match field(number) is created on name 2) Opportunity Match(number) is created on vehicle. 3) Develop a trigger :: 1) on Insert - The value in "Opportunity Match" field ...
0
votes
1answer
39 views

How to write a recursion triggers using on Custom Object? [closed]

I am Creating one custom object and create one new field that is 'Count' which is Number data type. When creating a record , I give '1' in count field and save it. My requirement is when i edit and ...
0
votes
1answer
23 views

ContentDocumentLink filter error on ContentDocumentID using IN clause

I have to get all the "linked" records from a Document (ContentDocument) and then filter only the Events from them using the following apex. // Query ContentDocumentLink object for the 'Event' link ...
0
votes
0answers
27 views

when checkbox unchecked picklist value change

when all checkbox check till s3 milestone stage value is Stage-4, if i uncheck s2 milestone only one checkbox stage name change into Stage-2 or of i uncheck S1 milestone any checkbox stage name change ...
1
vote
1answer
29 views

Convert String to array

I have a string ex.(a,b,c) which is inputted in a textarea(long). how can I convert it into array in apex trigger? Thanks in advance.
0
votes
3answers
39 views

how to add multiple triggers in a class

Im new in using salesforce, I have created multiple triggers with different objects. can I make them compile in one clasS? or I have to set them as is. Thanks for your help.
1
vote
3answers
63 views

Use a trigger or advanced formula field? [closed]

I am new to Apex programming and salesforce. I just want to know if I want a field to have a lot conditions; should I do that in the advanced formula section or should I create a trigger. Basically, I ...
0
votes
0answers
27 views

Task Completion Notification Emails to specific profile level

How to prevent the task Completion Notification Emails to specific profile level.Means we want send a task email to particular profile level Like IdentifyUser,Marketing, Sales. For that we have ...
0
votes
0answers
19 views

Dml Exception Update failed

I want to update the priority of the case based on transaction item and case type. It works perfectly when I use after insert event but it has System.DmlException: Update failed error when i ...
0
votes
2answers
28 views

Fire After Update trigger with respective method only if we update the respective field

I have a Handler Class and helper Class. Calling 3 Different methods from Handler classes. I want to call those Methods only when the respective fields are changed. public void OnAfterUpdate() { ...