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

learn more… | top users | synonyms

0
votes
0answers
11 views

Cant't execute process flow on apex lead conversion

I'm having trouble with the Database.convertLead method. I have a custom object ProductionOrganizer__c that has two relations: both to leads and contacts (RelatedLeadId__c and RelatedContactId__c). I ...
1
vote
2answers
25 views

Update field in parent when a related record is added

I would like to know that is there any way my trigger will be fired when any record is added to a related list . Right now , The trigger iterates through the related list records and updates a field ...
3
votes
3answers
115 views

Trigger to prevent edit on parent if there are no related child records

I've a scenario where there are 2 objects(Trail-master and Vehicles-detail) and no edits is to be allowed on parent if there are no related child records. I've tried the below code but without any ...
1
vote
1answer
29 views

Compare two fields

I have 2 object A,B A has 2 field id, name B has 3 field id, name, ismatching(default 0) Scenario is >> if I insert value in B , it should be compare B.name to A.name , if match is true then ...
1
vote
1answer
44 views

Nested Soql Queries in Trigger

**My Question: **I want to Create a case Record,in that Case Record contact Lookup Relationship field is there,if i give some Contact in Case Record,that Contact act as a Portal User ,that ...
2
votes
0answers
14 views

Box.com creating folder for record failing

i'm encountering a wierd behavior in my box.com integration for salesforce. Here's the code. @future (callout=true) public static void createFolder(Id id) { //Instantiate the Toolkit object ...
-7
votes
1answer
35 views

how to write a test class for this trigger, could anyone provide me the test class code for this trigger? [on hold]

trigger CTC_Update on Appraisal__c(after insert, before update) { List < appointment__c > AppList = New List < appointment__c > (); Set < Id > AppointIds = New Set < Id ...
0
votes
1answer
32 views

Auto populate lookup field

Can Someone help with a scenario. I have a region picklist field with 7 to 9 and we have a sales director lookup field whenever region is selected salesdirector for that region should be auto ...
0
votes
0answers
16 views

Feed Tracking replicated as an Apex Trigger [duplicate]

Does anyone have an example of Feed Tracking as an Apex Trigger?
1
vote
1answer
35 views

Trigger to use HTTP callout and update record with the results

I have been trying to integrate Google Shortener API into my salesforce org. I wrote a class to make the call out, but am having difficulty bringing the value back into the record. I have a custom ...
0
votes
0answers
23 views

Need to connect 2 custom objects together using an external ID and a Trigger

I have 2 objects which are parent and child. I am using Layer 2 Cloud Connect (Need to do it this way because it does replication and automatically updates any field changes between the 2 records) to ...
0
votes
1answer
36 views

Trigger, count related records

Here is the case I am working with now: There is a Custom_Object__c linked to Case object via lookup field (Custom_Object__c is a parent). After a new case is created, Case_Count__c field should be ...
-5
votes
0answers
16 views

send the Test class for below [on hold]

public class TemplateAssignment { public static void afterInsertprg(List < Account > account) { List < CEmailTemplate__c > CEmailTemplate = new List < CEmailTemplate__c > ...
0
votes
1answer
10 views

lastupdated contact address store in asscociated account address using trigger

Showing ERROR : but showing Compile Error: Invalid foreign key relationship: Account.contacts when user create contact with assocate there parent account and insert mailing address in ...
1
vote
3answers
39 views

Wanted to update few fields by trigger from parent object when new child record is created in salesforce

I want to update address from parent object when new child record is created by trigger because any time i can change the child record but by default it should have address from its parent object.
0
votes
1answer
13 views

How to hide a single record from Opportunity Product related list in standard salesforce page through trigger?

Can we hide a related list's record on parent object as soon as record save to database? I have requirement whenever Opportunity Product quantity is greater than 100, my trigger code validate it and ...
0
votes
3answers
22 views

Within an Event Trigger, how can I modify related Opportunity fields?

I have a trigger that is supposed to check if an Event picklist value is a certain value, and if it is, to change a field in its related Opportunity. I was able to pull the Opportunity's id with ...
0
votes
1answer
34 views

Need Help on Setting lookup field value in trigger [on hold]

I Need Help on Setting lookup field value in trigger Create custom object with label 'Demo Object' and API name Demo_Object. Create a 'text' field with label 'Category'. Create a 'lookup' field for ...
1
vote
2answers
23 views

Bulkify SOQL-Query in Trigger to search for duplicate objects

My trigger fires on my CustomObject ProductionOrganizer__c and searches leads with the same E-Mail or same LastName && Company (The object therefore has a field for email, lastname and ...
1
vote
2answers
13 views

In a new trigger on an Opportunity, how can I grab the owner's email address or other info if the type is Lookup(User)?

Ultimately, my goal is to send the owner an email with a trigger. This is my first time working with triggers, so bear with me, I'm still trying to figure it out. Starting small, I managed to use a ...
-1
votes
1answer
50 views

how to update field the following trigger and what is the meaning of that error [closed]

trigger CTC_Update on Appraisal__c (before insert) { List<appointment__c> AppList = New List<appointment__c>(); Set<Id> AppointIds = New Set<Id>(); ...
0
votes
0answers
27 views

I write a Dynamic Soql query. Now I want the query data

I created a trigger. in that i write a Dynamic Soql. I use a Sobject for Dynamic Soql Query. When ever i want to see that Sobject data at that time showing null pointer exception ...
1
vote
1answer
15 views

Record read only based on field create/update from external system [closed]

We have SFDC - Employee Integration with external HR System, Question is when we receive back the ‘Employee Identifier’ from HR System, I need to make the employee record read only? pls suggest ...
1
vote
1answer
31 views

How to fire a trigger on formula field by updating?

Here Amount_c is the formula field and Commission_Total__c is the parent object field where the sum needs to be updated while changing the amount in child object.but the trigger is not firing..please ...
0
votes
1answer
27 views

Test class on lead conversion trigger is not working

I have created a trigger on lead conversion to create contact of custom contact filed in lead. I have created some custom fields on lead object to capture alternate contact details apart from main ...
0
votes
0answers
16 views

Trying to get contacts to post to HubSpot via Apex

Writing a trigger to get Contacts over to HubSpot from Salesforce (not using the standard integration). Here is the Salesforce Class that I have: public class SendToHubSpot { public static void ...
0
votes
1answer
33 views

Create an Apex trigger to update the value of a picklist field [closed]

I'm trying to use an apex trigger to update the value of a picklist field on an Opportunity field related object. I would like to change the Opportunity field called “Status” (picklist field) to ...
2
votes
2answers
56 views

Check if executed trigger executes another trigger

I have a trigger on a parent object which manipulates the child objects. However (and as predicted), when the parent trigger modifies the child trigger executes. Is there a way for me to stop the ...
0
votes
0answers
23 views

Assign a custom pick list value on Opportunity Obj

the code below works for updating Opportunity Stage_Name field to "Closed Lost" based on the custom RFP_Response_Status__c field. However instead of assign "Out of Business" as a value to the ...
1
vote
1answer
69 views

Error message while sending email

I am trying to send some welcoming message to new a contact whenever I create. Where I wrote a class which contain email, sender display name and etc. I want to send email using trigger where the ...
0
votes
1answer
36 views

Trigger on child object to update parent object field

I need to update a field on Opportunity. Opportunity is related to OpportunityProduct. I've a workflow on OpportunityProduct where Evaluation Criteria is set as Evaluate the rule when a record is ...
0
votes
1answer
32 views

Apex code to reschedule the existing Salesforce standard object events to new available time slots [closed]

Scenario: Whenever any Leave_c record is approved,trigger should be fired .Any Events in the Users calendar between leave period ,need to be reassigned to the next available day / time.Considering 8 ...
1
vote
1answer
93 views

maximum trigger depth exceeded Opportunity trigger event AfterUpdate for [006R0000009RdT1]

The Trigger below i'm getting error when my IF statement has more that 2 conditions, I Understand it is a recursion issue. However not sure how to fix this, so i can include all the conditions below ...
1
vote
1answer
43 views

Update Multiple values for record in Apex Trigger

I have custom junction object between user and custom object. I need to update user record with junction object values for given user. Each user may have more than one record in junction object. ...
4
votes
0answers
68 views

Comparing trigger.old and trigger.new - both hold same value for a Field

Scenario: I have a trigger that will fire whenever a Primary Campaign Changes on an Opportunity by comparing trigger.old and trigger.new values of CampaingID, Issue: When I changed the campaign on ...
0
votes
2answers
61 views

Calling an Apex method on an Apex Trigger

I am trying to call an apex method on an apex trigger. But here i am receiving following error. Here is the code which i used. Apex Class: public class EmailExample { public void mailSending(){ ...
-1
votes
0answers
45 views

How to simulate triggers in unit tests? [closed]

I have a utility class that provides some generic trigger logic. This class is part of a package that can be utilized by subscribers in their local triggers. How can I write unit tests for this class ...
-1
votes
1answer
15 views

EmailMessage before insert trigger not working as expected?

I have a before insert trigger on EmailMessage object and here is the trigger: It just adds some extra content to the end of the email content. trigger EmailMessageTrigger on EmailMessage (before ...
1
vote
2answers
34 views

Need to Disable Button for particular status picklist Value

I have a custom button on Contact Screen and a Contact Sync Status Picklist with values New, Modified, Submitted and Activated. On click of button Status will be set to submitted which is done via ...
3
votes
1answer
30 views

Marketing Cloud Triggered Emails with Custom Variable

I have a triggered email I’d like to pass a custom variable to. I’m triggering the email via the RESTful API and JSON. I've tried inserting %%dateandtime%% and %%[dateandtime]%% into my email with ...
0
votes
1answer
21 views

Testclass to check date change

I have a trigger that changes a date field based on activity on related object. The trigger works fine but the test class that I created didn't work and has 0 coverage. So basically, if there is a ...
1
vote
1answer
31 views

help in Apex trigger

I have requirement to update user record based on insert/update Junction object between custom object and user. I need to update user custom field accountdef with junction object values(more than one ...
6
votes
1answer
141 views

Apex Test Class - Can You CRUD Without Firing Triggers - On Purpose?

Is there anything built into Apex that lets one perform a CRUD operation on an SObject and suppress the related firing of any Apex Trigger / Workflow Rule / Process Flow? (Similarly to the way one ...
1
vote
1answer
10 views

Quote Trigger Initial term of field expression must be a concrete SObject: Boolean at line 32 column 89

I can't seem to figure my issue here on the code below. Originally I had Opportunity__c and was getting a invalid field error. I replaced Opportunity__c with the OpportunityId field and received the ...
1
vote
3answers
27 views

showing an error message to prevent deletion/ sending an email

I have 2 objects object 2 has a look up to object 1. If object 1 record is deleted it should send an email with the details provided in the code( which is working as expected). Now if object 2 has a ...
2
votes
1answer
11 views

Assigning attachment on lead conversion to opportunity

I have a problem with apex code thats supposed to delete attachment added to account after lead conversion, and then add the copy of this attachment to opportunity. But when i convert my lead, ...
0
votes
2answers
33 views

How to backup modified record or field value?

I have few records in one custom object. If some one modify any record, I need to store the modified data. In above picture, if someone modify Answer field value to 10000, i need to know the past ...
1
vote
0answers
29 views

Email notifications

we are facing some task completed mails...After receiving completion mail we are unable to insert RelatedTo field.while we are trying to insert RelatedTo field it has showing in the template Related ...
1
vote
1answer
16 views

Mark a lead duplicate and assign to owner of original lead

I am trying to match Lead based on email address and Phone. If there is a match found then mark the status of lead as duplicate and owner should be same as existing lead owner. I have written the ...
1
vote
1answer
20 views

HTTP Request Ignoring Body

I have written a trigger that parses url's stored in a number of objects and requests them to see if they are still valid. private Boolean pollserver(string url, string referer) { ...