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

learn more… | top users | synonyms

0
votes
1answer
13 views

Unexpected Behavior in Unit Test

I'm running into a somewhat bizarre situation when trying to run unit tests for my apex code. The functionality is that when a contact is created, a child record of a custom object is also created and ...
1
vote
1answer
27 views

Test Not Covering All My Trigger Code

I have created a trigger that fires when a Task is Inserted, Updated, or Deleted. When it fires, it updates custom checkboxes on open Opportunities based upon the Subject of the Task and checks to ...
1
vote
1answer
7 views

Problem with assignment of automatically created opportunities

I've got an Apex trigger that automatically converts incoming leads if certain conditions are met. These leads are themselves added to the system via an API call from my main application. I've also ...
0
votes
1answer
38 views

Insert a record for each field filled out

I have an object named Activity__c that has several picklist fields. For reporting, I need a way to aggregate the data from the picklist fields in a standardized fashion. When Picklist1__c, ...
0
votes
0answers
26 views

Help with Inserting an Opportunity in a TEST Class for Code Coverage

I'm having issues with an APEX test class to provide code coverage to a Trigger I created. Here is the code of the Trigger. trigger UpdateOpportunity on Opportunity (before insert, before update){ ...
0
votes
0answers
7 views

Showing Error/Validation Message on the standard convert page(lead to account convert page)

I have a requirement,when we convert a lead to account,if there is any activity we try creating on conversion. We want to ensure one of the activity field has a value. If user doesn't select a value ...
0
votes
0answers
11 views

Send an email/message notification on Task create on a Custom Object

I have a requirement where a Task is created by a third party application using REST API in my salesforce.com domain. I want to notify a Group of users on such a scenario. I wanted to user workflow ...
0
votes
1answer
21 views

Trigger Help to reassign associated contacts and opportunities

I have the trigger below to move all associated contacts and opportunities when we change account owners through a data loader. It is catching all of the contacts but is occasionally missing some of ...
0
votes
0answers
27 views

SOQL: Too many query rows even when only 1 is returned

My question is in addition to the issue described here: System.LimitException: Too many query rows: 50001 What I don't understand is that my query only returns 1 row so how is it possible that I'm ...
0
votes
1answer
29 views

Enable Partner User Button Apex

So i've been looking around on the communities documentation, and I haven't found anything on this button and Apex. I'm trying to select the 'Manage External User's' and 'Enable as Partner' in an Apex ...
0
votes
1answer
29 views

Call Trigger based off Case Field

I only want this code to be called when a case field has a particular value or values. e.g. (A or B) or (A and B) Finding it tricky to get this working in my trigger. Has anyone done this before? ...
0
votes
0answers
30 views

Design Advise Needed for Lookup Roll Up Summary Without a Trigger

I have a custom object called Sales Leaders which contains a field called total AGP (Allocated Gross Profit). This needs to be the sum of all Sales Leader AGP values on the Opportunity. It's not ...
1
vote
1answer
25 views

Insert multiple child records with different dates after insert of parent record

I'm working on functionality to create Activity__c records in bulk when a PlanSchedule__c record is created. I am able to insert X number of Activity__c records based on a calculated value derived ...
0
votes
1answer
27 views

Trigger on Custom Object from different Namespace

I am attempting to design a managed package that performs a specific action on a custom object. I can include the custom object in the package and let customers use that object to access the ...
0
votes
3answers
27 views

Picklist Values Synchronizing across objects

Good afternoon I am hoping someone can help. I have spent the last couple of hour’s researching the different possibilities and I am none the wiser Aim – If a value is added to the following field ...
1
vote
2answers
69 views

Salesforce trigger throws read only exception upon insert

Upon creation of new user, in context of private sharing model, I want to create new default records for Sobject jobs__c which need to be identical across the organization (as these are referenced by ...
0
votes
1answer
21 views

Getting Error in the following trigger

Error: Compile Error: unexpected token: 'List' at line 6 column 1 trigger AbortInsert on Adder__c (before insert) { System.debug('****************************************'); List& ...
1
vote
1answer
37 views

Trigger Best Practice Question

I have 3 custom objects. Expense__c (Parent) ExpenseChild__c (Child) ExpenseGChild__c (Grand Child) All the relationships between a parent and its immediate child is M-D. I have built the ...
1
vote
1answer
82 views

Changeset Error

This change set contains components that require the "33.0" or higher platform version. Please select an organization with a platform version of "33.0" or higher, or remove all incompatible ...
1
vote
1answer
32 views

Adding Ordered Sequence Numbers to Child Records

I am trying to write a simple trigger that adds a sequence number to a list of child activities based on the date the activity is scheduled for. Basically I want to get all Activity__c records for ...
1
vote
1answer
46 views

Populate User lookup field by trigger

I have a need to populate a lookup field on a custom object with a partner user. The only problem is that I need this to be populated with the partner user who is set up as a contact under the account ...
0
votes
1answer
21 views

I want to bulkify my trigger! Could somebody help me with this

trigger NewTrigger on Candidate__c (after insert, after delete, after update) { Log_Object__c log=new Log_Object__c(); boolean check=false; if (Trigger.isInsert) { ...
1
vote
3answers
61 views

adderror behaves differently between before / after triggers

I have written a trigger handler to prevent more than n incidents for a client(lookup to user) at any point of time. This handler behaves differently if choose (before insert, before update) i.e. the ...
0
votes
2answers
29 views

Trigger Contact update Name from custom field

I have a custom field that is automatically updated and when it does if it does not match the Contact name then Contact name needs to be updated based on the custom field. I'm new to this so any help ...
0
votes
2answers
45 views

AddAccountTeamMember : System.LimitException: Too many DML rows: 10001

Please Help me the Following Code when i Ran "AddAccountTeamMember: System.LimitException: Too many DML rows: 10001" public class AccountTeamMemberExample{ public static void ...
1
vote
0answers
20 views

Trigger on Manage Currency

I am having a requirement in which if a user create a record of manage currency(Setup > Company Profile > Manage Currencies) after creation of the record a custom object record should also be created. ...
1
vote
2answers
70 views

Apex Trigger to Create Task from Lead

I need some assistance. Aim : create a Trigger that creates a task from a lead record when certain criteria is met. Lead criteria : Object : lead RT: Registration lead Source : Property Task ...
0
votes
1answer
29 views

Confirmation Box in apex code invoke by a trigger?

We have a requirement,where user selects a value on set of records and on save they should get deleted depending on what value they select. I want to show them a confirmation box like 'Are you sure ...
0
votes
1answer
17 views

Help with Trigger to Stamp Text Field from Parent to Child

I'm starting to learn Apex and work on basic triggers so apologies in advance if the code is bad. Architecture: Parent: Opportunity; relevant fields = Draw_4__c (checkbox), Project_Stage__c (text) ...
-2
votes
1answer
19 views

I have trigger and i have written test class for this its showing 46% how do cover the test coverage

trigger creatingMenuDetails on Opportunities__c (after insert,after update) { list<Menu_Detail__c> MD=new list<Menu_Detail__c>(); for(Opportunities__c op:trigger.new) { ...
0
votes
0answers
24 views

changes to record in “before update” trigger don't seem to be saving

trigger WorkNumbers on PO_Item__c (before update) { public Decimal recdModifier; for(PO_Item__c newItem :Trigger.new) { PO_Item__c oldItem = Trigger.oldMap.get(newItem.Id); ...
1
vote
0answers
11 views

Calculating field value and insert to auto-response mail (email-to-case flow)

I have following request from business: Calculate the expected response time based on business hours and set field on case. Insert the calculated response in the auto-response email sent to ...
2
votes
1answer
24 views

Storing json as a String field is giving wrong value

I have been developing an Apex Trigger where I build a json string from an incomming Event. What I do is serialize the event into the json at first, then deserialize it as a Map and add to it some ...
-1
votes
0answers
24 views

This trigger sets the owner of the account record type to be the same as the owner of the other account record type

I need to write test class for this can anyone help me out how to achive this . trigger accountRecOwnerUpdate on Account (before insert) { // This trigger sets the owner of the account record to ...
0
votes
2answers
29 views

Upward Traversal to AccountId in OpportunityLineItem Trigger.New

Wondering why I can't access the AccountId through upward traversal in the below instance. This is in a Before trigger on OpportunityLineItem. Set<Id> accountIds = new Set<id>(); for ...
0
votes
2answers
51 views

deduplication trigger to require uniqueness based on the value of two or more fields

I am trying to extend the functionality of the Force.com Cookbook "Preventing Duplicate Records from Saving" trigger found at ...
0
votes
2answers
35 views

Create a queue with a trigger from a custom object

I'm trying to do a trigger to create a queue from a custom object and I'm get this error: Review all error messages below to correct your data. Apex trigger ProjectHandler caused an unexpected ...
0
votes
1answer
27 views

How to extract Name from id,which a Lookup field catches?

I have Lookup field value of object A and used trigger to display the same field value in object B.If I use a field of type text,then I can see ID.if I use a field of type Lookup,then I can see the ...
0
votes
0answers
24 views

Workflow fire after (after trigger) to send email is not working

I am having a requirement to send email to custom object record owner with a link of case record once it is created. There is no relationship between the custom object and case object. To achieve ...
0
votes
1answer
34 views

Insert Trigger on Account(Using MAP)

In my trigger,I would try to update contact description field when i insert a new account and add some value in description field,But when i save the account i will face this error. trigger ...
0
votes
2answers
38 views

How to track DML operation without using triggers

I am trying to insert/update/delete/undelete records of opportunity team into custom object.This should be acheived without using any Trigger on Opportunity Team. generalizing my question; how ...
0
votes
2answers
79 views

Apex Trigger on Contact to Update Field on Account

I have a custom field on Account called "Contact_Exist__c" (api name). I'm trying to write an apex trigger on contact that when the field is updated/inserted and it has an account name linked or ...
0
votes
1answer
23 views

Copy Formula field into Number field

Iam trying to copy the Amount from formula field into number field through trigger but it doesn't seems to be copying, i know i can do this through workflow but since this is an amount conversion for ...
0
votes
0answers
45 views

“Too many SOQL queries: 101” alerts

Since I deployed the Apex trigger below, I got many "Too many SOQL queries: 101" alerts which were caused by other triggers. Here is the code of the new trigger: trigger calcBusinessHoursSecurity ...
0
votes
2answers
69 views

System.LimitException: Too many DML rows: 10001 when updating one record

So in attempting to write a trigger to roll-up numerical values via a lookup field, I appeared to have made a mistake in the code so it updates enough records to throw an error. I thought the way it's ...
0
votes
3answers
39 views

Trigger Issues while deploying

I have created a trigger to calculate number of Contract on Account. Trigger- /* Provide summary of Number of Contacts on Account record */ trigger ContactSumTrigger on Contact (after delete, after ...
0
votes
1answer
22 views

Broken Parent Rollup trigger: System.NullPointerException: Attempt to de-reference a null object on trigger

I'm getting the following error when attempting to mass update accounts via Data Loader. The id throwing the error is the same in each instance. The Trigger (listed below) is meant to aggregate field ...
-2
votes
2answers
28 views

Invalid TYpe in Map

Here i am trying to hard code the map trigger Mapcls on Candidate__c (before insert) { Map<Country__c,Curtyp__c>mymap=new ...
1
vote
1answer
34 views

after update trigger causes unexpected exception

I have two custom objects: Contract__c and Address__c. Address__c has a value__c currency field on it. Contract__c has a rollup summary field, which holds the maximum value of the attached ...
3
votes
1answer
32 views

Assigning an input value to standard/custom field dynamically

I'm working on custom workflow field update I have taken the value to update as input field and by using the map<> method I'm getting the api name of the field and storing it in a record Now I ...