Tagged Questions
A trigger is an apex code, that can be executed before or after DML operations
0
votes
1answer
26 views
How to write a trigger which shows error while creating a contact record which does not allow duplicate values for phone field
I want a trigger which gives error while creating a record in contact which does not allow duplicate values for phone field
-2
votes
3answers
30 views
before insert trigger
trigger PopulateTrigger on Contact (after insert){
Account accs=new Account();
for(Contact c:Trigger.New){
id aid=c.accountid;
c=[select phone from contact where ...
0
votes
2answers
26 views
Regarding Triggers
How to update the records in after insert and before update trigger at same time with same field, actually I am struck with the code
trigger PopulateTrigger1 on Contact (before insert,before ...
1
vote
1answer
19 views
Please help me to create trigger on object Name “ Booking”
If Booking Status is 'Confirmed' then
+Room number is required,
+Check in Time is required,
+Check Out Time is required.
Please check my below trigger code is not working
trigger bookingTrigger1 on ...
-1
votes
1answer
37 views
Trigger using before insert,before update and after insert
trigger PopulateTrigger on Contact (before insert,before update,after insert)
{
List<Contact> con=new List<Contact>();
if(Trigger.isbefore){
For(Contact c:Trigger.New){
...
3
votes
4answers
145 views
Need help in bulkifying the trigger
I have a trigger to insert a new record in custom object'Case Status History' whenever the Status of a case is updated. It is working fine with a single record, but when I change status of 4 cases at ...
1
vote
0answers
16 views
Auto creation of Sales team from Account team on Opportunity creation
I want to copy Account Team & Account Share records to Opportunity team & Opportunity Share objects while creating a new opportunity.
I have accomplished this by writing a trigger. Anyhow I ...
0
votes
1answer
32 views
How to have no more than 65 tasks for any single date?
For ex In task activitydate is Apr 1st i have to insert only 65 records on that date,using dataloader on that date i have 10 records already there i am inserting 70 records then 55 records get ...
3
votes
1answer
76 views
Future method cannot be called from a future or batch method: Error
I have two classes class A and class B, I am trying to call Class A's future method from class B's method and I get this error :'Future method cannot be called from a future or batch method'.
Class ...
0
votes
1answer
53 views
Trigger to check duplicate Phone and Email [duplicate]
I've to write trigger on lead object to check duplicate phone and email.
one checkbox field Named Duplicate on lead object.
If duplicate record found , checkbox to be checked.
User may Either enter ...
0
votes
2answers
40 views
Trigger lookup just not working
I am trying to populate a lookup field based off of a list of records in a different object. The problem is the 2 objects are not related but they have a field that is the same. Is it possible to do ...
0
votes
1answer
26 views
trigger to check duplicate record not working
When duplicate record found based on either Phone or Email then only duplicateRecord(Checkbox field) should be checked.
I wrote the trigger to check duplicate record based on Phone or email but it is ...
0
votes
1answer
41 views
How to update a child object with lookup relation on parent object?
Here is my code:
trigger UpdateChildBasedOnParent on LSDoctor__c (after insert, after update){
List<LSPatients__c> childRecords = [Select DoctorToPatient__c, Doctor_Patient_Status__c ...
3
votes
4answers
81 views
DmlException: Update Failed. Maximum Trigger Depth Exceeded
I have below trigger code getting -
DML Exception 'Maximum Trigger Depth Exceeded'.
Can someone help me please?
Apex Trigger
trigger updateAoC on Contract_vod__c(after update) {
...
2
votes
1answer
29 views
Re-parenting Trigger Incorrectly Re-parents all Children to a Single Parent
I wrote the folloing re-parenting trigger to reparent Contacts with their parent Accounts, this is based on a unique identier (TFID). If I test each record one by one they all re-parent correctly, ...
1
vote
4answers
52 views
formula value changes I want the trigger to update fields
My trigger fires if I edit/save Account only but I want it to fire once the Contract_End__c == Today_10_Trigger__c. The Today_10_Trigger__c is a formula.
I'm getting the impression that triggers will ...
0
votes
1answer
16 views
System.UnexpectedException: INACTIVE_OWNER_OR_USER: owner or user is inactive
I have below trigger that needs to activate the User as well as generate reset password link for the same when a custom checkbox field is checked. Below is my apex trigger code that throws this error ...
0
votes
1answer
18 views
Generate an account code for SAGE Accounting allows 9 but need it to stop at 8
/*
Updated by PAH 2013-05-29 to set the Sage_Account_Name__c to a unique Name that can be used by Sage
need to add is isInsert and keep old code in teh isUpdate
*/
//trigger ownerLookup on Account ...
-2
votes
1answer
29 views
CROSS-OBJECT UPDATE
So, this trigger is designed to pull the role name from User obj (which is a lookup to Role) and update the account field on the Contact obj (which is a lookup to Accounts). Im currently getting error ...
-1
votes
1answer
17 views
Test class to test email messaging
How do I test a email messaging trigger? Below is my code and I am trying to test the code for sending email. How do I perform the assertion?
I have the below trigger:
trigger ...
1
vote
2answers
20 views
Send Email only if the field value changes
I have a below trigger created where I use a field called Hiring Manger to identify the user's email id and send an email to the person that a project is assigned to them. But my trigger runs every ...
0
votes
0answers
10 views
How many subscribers can be added to a single triggered send SOAP call?
How many subscribers can be added to a single triggered send SOAP call?
Create
https://webservice.s8.exacttarget.com/Service.asmx
...
1
vote
3answers
21 views
Debug logs does'nt appear on apex trigger
I am trying to debug below trigger:
trigger SendEmailToHiringManger on SFDC_Job_Opening__c (after insert, after update) {
list<SFDC_Job_Opening__c> i = [select id,Hiring_Manager__c,Name ...
0
votes
1answer
25 views
Counting Total Number of Cases Created in a day [closed]
I Have to Count Total Number of Cases Created in a Day and Save it in Custom Object CaseReplica__c .For a particular day only one record of CaseReplica__c should be created.
Total Count of Cases ...
2
votes
1answer
24 views
Delay in Queueable job execution
I have a Queueable job en queued by a custom trigger and the Queueable job makes REST API call to an external system. When I monitor the job, it used to start processing in couple of minutes but in ...
0
votes
0answers
22 views
Trigger not getting object field
I am facing a issue of trigger ,
"Variable does not exist: Description"
Please suggest what's i am doing wrong, I have checked "Description" field is exist in Account object.
0
votes
1answer
22 views
Copy parent fields to child fields
I have a account object for that object i have a parent account in that parent account i have a number field called "Productalue". when ever productvalue is 0 or 1 at that time i have to copy the ...
-1
votes
2answers
18 views
Issue with Merge fields when I send email through trigger
Hi Can you please debug and fix this trigger.
When I send a mail through trigger merge fields are not picking automatically. Its showing empty.
trigger SendEmailNotificationtoCandidate on ...
6
votes
4answers
113 views
best way to handler trigger Recursive call
Below is my code snippet that I have used. And also I used static Boolean to handle the recursive call.
But when I update more than 200 records then trigger only process first 200 record not all the ...
0
votes
1answer
23 views
Unable to update the no of contacts field on account
I am trying to update the no of contacts custom field on account after insert and after update on account but i don't see the field getting updated.
Here is my code///
trigger ...
1
vote
0answers
14 views
Trigger Question - Automating territories
I'm trying to create my first trigger... it should lookup a ShippingPostalCode and compare it to the Zip_Code__C field in a custom object I've created (Zip_Codes__c) and return the Area_Code__c field ...
2
votes
1answer
35 views
No such column 'MailingAddress' on entity 'Contact' in Trigger
We have an APEX after update trigger on Account which does a SELECT MailingAddress FROM Contact, and we are getting the following error from Salesforce:
No such column 'MailingAddress' on entity ...
4
votes
1answer
28 views
Trying to query the Lead's Owner's UserRecordAccess .HasReadAccess
I want to query a Lead record and find out if the Lead's Owner has read access. I tried the following query but it fails.
select Id, Owner.UserRecordAccess.HasReadAccess from lead WHERE Id = ...
3
votes
1answer
100 views
Emails are not sending?
in my requirement if any duplicate lead is created send email to lead owner
code executed successfully but emails are not sending , what is the problem ?
my trigger
trigger LeadCategory on Lead ...
1
vote
1answer
34 views
trigger to check duplicate on phone
I write the trigger to check duplicate phone on lead object;
Code as:
trigger DPhone on lead(before insert,before update)
{
List<Lead> Leadlist =new list<Lead>();
for(lead ...
2
votes
1answer
21 views
Lead assignment trigger not firing on Pardot Leads only
I have a trigger that assigns incoming leads to the Account owner if an account already exists. It looks for a matching email domain field.
This trigger works fine if i or any other user creates ...
1
vote
1answer
28 views
Unit Test on FeedItem Trigger that has callout throwing You have uncommitted work pending. Please commit or rollback before calling out
I am creating a unit test around a feed item trigger that is doing a callout. The code works as excepted, but when I do that unit test I am getting the exception You have uncommitted work pending. ...
1
vote
2answers
168 views
How can I insert data into an Account field from an opportunity trigger?
Check my code below, I am trying to insert a value into an Account field but I am getting an error.
Apex trigger StatusTrigger caused an unexpected exception, contact
your administrator: ...
2
votes
3answers
23 views
How do I select all opportunities under an Account?
I wish to select all opportunities on an Account, how do I go about it?
I have tried this:
trigger StatusTrigger on Opportunity (after insert, after update, after delete) {
Set<Id> ...
1
vote
2answers
24 views
Update Opportunity Stage when DocuSign Envelope Status is 'Signed'
I am very new to triggers but would like to set up a simple trigger. Any help is greatly appreciated! Pseudo code below.
on insert or update
if (Docusign Envelope Status is equal to 'Signed' AND ...
1
vote
1answer
52 views
Get all the object using a field value- SOQL
I have a custom object called abc__c , which has a field(text)-> field__c. I would like to get all the records where field__c value is "Hello". How can write a query for this in query editor.
I tried ...
0
votes
1answer
56 views
Trigger An Email
I need some assistance. We would like to set up an email to be sent the day after someone has attended one of our events. Any thought on how that can be done? Thanks !
It's based on the Campaign ...
2
votes
4answers
128 views
How to update the status of an Account based on opportunities
I want to be able to update the status of an account based on condition of all opportunities in an account.
According to the following, I want to be able to set an account status field as Active if ...
1
vote
2answers
43 views
Too Many SOQL Queries: 101 - trigger
I am getting error message and I believe it to be error with this trigger. I am new to coding and this was done previously so any assistance is greatly appreciated
trigger setAttendeeNumbers on ...
-1
votes
0answers
25 views
Help with test class for lead conversion in apex class
Can any one help me out with test class for lead conversion class?The test code coverage value is showing less.In our org we have a class written and the test class,but the code coverage value is ...
0
votes
1answer
22 views
Get related list information from an Object
I have an object called position__c and skill_profile__c. I have a juntion object - position_skill_set__c , which is a junction object between postion__c and skill_profile__c. The junction object ...
1
vote
1answer
23 views
Marketing Cloud API - Replicating Triggered Send Functionality
Scenario: Customer information is imported into the Marketing Cloud daily into a Data Extension. This Data Extension contains is all users who have made a purchase.
Added to that, a newsletter signup ...
1
vote
1answer
29 views
Is there a way to determine if EmailMessage has reply
I'm after finding a way to know if a EmailMessage object has a reply?
I have tried to use Trigger after insert but I do not see its picking.
Any other better way?
when the user response to ...
3
votes
0answers
25 views
Design pattern to manage record caching in an Apex execution
I am looking for a good caching design pattern that is comprehensive enough to be used OOTB. This pattern would ultimately produce a central manager class that all classes/triggers used to get records ...
1
vote
1answer
18 views
Event parent relationship fields are null in trigger
I am populating a junction object on from Events and want to capture info from the Event but getting the Account from Account field pulls null. Same who the name via the Who. But if I query the Event ...