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

learn more… | top users | synonyms

1
vote
4answers
29 views

Initial term of field expression must be a concrete SObject: String

I'm trying to populate a field in every opportunity that is created that has a value based on the account that it's a part of. Both the account field and the opportunity field are picklists, as there ...
4
votes
1answer
18 views

Do assignment rule owner updates cause Update triggers to fire

Reviewing the "Triggers and Orders of Execution" document leads me to believe that only workflow rule field updates cause Update triggers to fire if field updates occurred. I'm seeing an instance ...
1
vote
1answer
24 views

How to rollback the operation and display a message after a custom exception?

I have a page using an extension to the standard controller, when the records are saved using the standard save method, an after insert trigger is fired and does some validation, I have created a ...
2
votes
3answers
146 views

Improve trigger execution with multiple threads of execution - Possible? Alternatives?

How to dispatch records from trigger to be processed by different threads in order to accelerate trigger execution and not to fail the whole trigger if the error happens. if we update another records ...
1
vote
1answer
29 views

Copy One custom field value to another custom field for a custom object

As in the accounts edit page, I want to achieve the Copy Billing address to shipping address for a custom object. I know this can be done either WF or trigger but I want that to be dynamic and based ...
4
votes
1answer
62 views

Executing workflow/trigger before autonumeric field is calculated

The scenario is: I have an autonumeric field Perspective_Code__c. I have a text field Original_AC_Code__c. I have an external id text field Opportunity_Code__c. When a record is inserted/updated, ...
0
votes
0answers
23 views

Roll Up Summary fields on lookup relation ships

we have scenario where i am updating roll up summary fields values such as count and sum in account object. In one case i am deleting the parent object and the count of the parent object is getting ...
0
votes
0answers
9 views

Updates comments to custom object with Approval process comments from ProcessInstance set of objects

I have a trigger that updates the approval comments from ProcessInstance / ProcessInstanceSteps to a Object Order_vod__c. Earlier I did this using Apex trigger and the code worked. Here is the code - ...
3
votes
2answers
64 views

Trigger execution context and Limits

Is the whole data set processed within single trigger execution context? Or each 200 records has seperate execution context within trigger? Lets say we have 400 records and they are updated and ...
3
votes
2answers
40 views

How to test for DML errors in 'before' triggers (i.e. use of addError)

here's a brief rundown of the trigger I'm trying to test: this trigger is trying to put a cap on records with a certain lead source. If someone selects this source and tries to save the record, it ...
0
votes
1answer
42 views

Updating a record without DML

I am writing an after update trigger on OpportunityLineItem that will update an opportunity based on values retrieved from it's respective line items. By sheer accident, I forgot to include the ...
0
votes
2answers
22 views

Trigger to populate Opportunity Stage on related task

Can I get help with a trigger that will populate the opportunity stage on a related task? I'm very green with triggers so you cannot get to basic if you feel so inclined. Thanks for the help.
-1
votes
0answers
14 views

Salesforce: Create a trigger to update custom field on custom object by standard product price [on hold]

How can I achieve that my custom field Hose_Standard_Price__c will be updated by the value of standard product price unit ( I presume is this field: UnitPrice) after update & after insert. Thanks ...
2
votes
2answers
47 views

trigger to send email with pdf as attachment

I have a requirement where if I edit /insert a record, every time a pdf containg the field's value of that object will be generated and send as an attachment to the user. I wrote the below code. ...
5
votes
1answer
33 views

How to set a field value based on a long list of other fields

I'm looking for a best practice suggestion here as there are a couple of ways to solve this. Based on if any of about 40 fields have any value I want to run a specific approval step. So my first ...
0
votes
1answer
34 views

uncheck checkbox for remaining record in same object if one record checkbox is checked

I am using before update trigger I want to uncheck checkbox for remaining record in same object if one record checkbox is checked. trigger trigger_ManagePrimaryMember on Team_Members__c (before ...
0
votes
1answer
28 views

execution of AfterInsert caused by: System.FinalException: Record is read-only:

trigger GudMorning on Class__c (before insert,after insert) { if(trigger.isbefore){ for(Class__c c1 : Trigger.new){ c1.State__c = 'AP'; } } else { ...
2
votes
1answer
25 views

Trigger for passing picklist value from Campaing to campaign members custom field

Brand new to Apex with rudimentary programming skills. Here's what I'm trying to do: I'm trying to pass the campaign type (email, webinar, etc...) from the Campaign to it's Members. What I'd like to ...
3
votes
1answer
57 views

Trigger on Task/Activity - can you access Activity?

I need to have a trigger that updates a date on the contact based on whether a task was created with two specific dispositions (Call_Disposition__c is a custom field on the Activity). Since the field ...
3
votes
0answers
47 views

Implementing Trigger Framework(KevinOHaras)

I've been researching some best practices, and trigger frameworks and I found Kevin O'Haras TriggerHandler Framework. Now I don't fully understand it, I don't understand how to reference the Trigger ...
5
votes
2answers
67 views

System.QueryException: Aggregate query does not support queryMore()

I am trying to deploy around 80 Components which include Apex Class,Trigger and Visualforce Pages. But it is failing due to below exception, MyTrigger: execution of BeforeInsert caused by: ...
2
votes
1answer
24 views

What would cause a trigger to execute twice?

I have a before update trigger that essentially records upgrades or downgrades when an opportunity gets updated and then logs this change in a new custom object. The concept is pretty simple, for ...
3
votes
2answers
67 views

I am getting this error: System.LimitException: Too many SOQL queries: 101

I am getting this error System.LimitException: Too many SOQL queries: 101 when I run the class bellow. It seems like it is affecting all the triggers linked to NRProducts__c Object(This object has ...
-2
votes
1answer
37 views

To Update a field in user object of salesforce by using another custom object

I would like to know how to update fields in user object when i enter some values into the fields in a custom object. Here i tried using trigger. I have tried by writing a trigger when a value is ...
1
vote
1answer
13 views

Counting account totals within another account type

In our Salesforce deployment, we have two account types (partner and merchant). Merchants have a custom field that contains their parent "partner" account. I am trying to write a trigger (on ...
1
vote
1answer
38 views

Can we create report folders through Apex

I like to create a report folder via Apex trigger/class is it possible. Thanks in advance
0
votes
2answers
44 views

Trigger to update 2 picklist values

I have a requirement for updating two picklist value if a checkbox is ticked. Feedback__c is one object which has Status__c and Resolution__c picklists. Feedback_Comments__c is another that will ...
1
vote
1answer
37 views

Need a trigger that will return(rolls up) minimum value from child records to Parent Record

I have two standard objects Quote QuoteLineItem Each Quote may have one/more QuoteLineItems or maynot have any QuoteLineItems. Quote and QuoteLineItem are related with Master Detail Relationship. ...
0
votes
0answers
30 views

Dynamically upload attachments with trigger

I have an integration in place for Infor LN ERP to Salesforce (Inforce). Part of the integration covers the synchronisation of invoices for which there is a invoice object: InForceEW__invoice__c ...
3
votes
3answers
51 views

Quick way to clear all classes and triggers

Long story, but I want to clear all the code from an org. I don't need to clear Visualforce pages (there is only one, and I'm deleting that manually) - just all triggers and Apex classes. Does anyone ...
1
vote
1answer
45 views

List Exception caused by trigger

I have some code in a trigger that works when tested, and works in my sandbox, when I get it into production every time something happens where the trigger should go off, I get this error: Apex ...
0
votes
2answers
16 views

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY when subscribing role members to a record

I created a trigger that on a record creation (Custom sObject), subscribes all the createdBy role members to the record. This code seems to work just fine when executed by a sys admin, but it throws ...
0
votes
0answers
25 views

Can we update public group members when a username in user object or any custom object is updated?

I am having one custom object called clubmember and I wrote one trigger which insert and delete the member to public group object. I like to know how to write a code to update(i.e if the user change ...
2
votes
1answer
66 views

Restful webservice with XML in Salesforce

I am trying to write this below xml from Contact object.Problem is compostion of the xml with nested childs is really complex.Can you help understand to demistfy this problem. "<request ...
1
vote
1answer
47 views

Trigger on Account when an attachment is uploaded to that account

Can I detect when an attachment is related to an account from a Trigger on account ?? Also, I want the trigger to post to chatter that the attachment has been uploaded upon completion.
2
votes
2answers
33 views

Prevent Failure of complete Trigger

I have an issue, which might be familiar with most of you all. We are getting Cases from Oracle via Command Line Data Loader Programs. It is quite possible that one record has a data issue which ...
3
votes
1answer
29 views

Sending HTTP callout after a Lead record is updated

I have a requirement where I have to send Lead data from Salesforce to TIBCO server once Send_to_CRM__c check box goes from false to true on Lead update. Once updated 2 web-services are suppose to go ...
2
votes
1answer
39 views

Create an event after a record has been approved

I want to create a event after my record have been approved, I have a checkbox checked when my record is approved so I can create my event, but the record will be locked !!!! There were custom ...
-5
votes
3answers
42 views

Trigger Problem [closed]

I created a trigger on Campaign Member when ever the Status is added to campaign memberautomatically task have to created to sfdc account owner but But in SOQl how can i reterview the Sfdc Account ...
3
votes
2answers
59 views

How to create a master-detail object picklist to picklist trigger

I am new to creating triggers and would love some assistance in creating a trigger that can mirror a picklist values. I have two identical picklists called "Test_Status__c" on both the Account object ...
0
votes
0answers
33 views

Update Field on Opportunity from Activity Field

Activity Field API: Next_Step__c Opportunity Field API: Next_Step__c Scenario: When logging an activity (whether an event or task) - and Next Step field contains data - this should update the custom ...
0
votes
0answers
25 views

Issue with One to One Accounts and Converting Leads

I'm currently working on a system that has the Nonprofit Starter Pack with One-to-One Accounts enabled. I have made a trigger that changes the default account of a contact to some account that has ...
0
votes
0answers
21 views

Skip Lead Assignment Rule for Named Accounts

How can I get leads from specific companies, i.e., leads meeting specific filter criteria, to skip assignment rules and go directly to a designated rep? Currently my trigger assigns named account ...
1
vote
2answers
32 views

Is there a way to make an LDAP call through a Trigger?

I searched the APEX documentation and I didn't see anything relating to LDAP. We have the ID for a customers Active Directory [AD] profile stored within Salesforce. We are looking to call AD and ...
1
vote
1answer
26 views

Opportunity After Update trigger fires Account Triggers - any way to disable it?

In one of my Oppty after update triggers, I found that the account triggers fire as well. Why is the account updated ? (I am not updating values on the account object) Is there a way to control ...
3
votes
3answers
224 views

Triggers Best practices

We are experiencing performance issues on our org and over the years the size of the org (data + bus logic components like workflows, triggers, fields etc..) have grown rapidly and exponentially. We ...
1
vote
1answer
41 views

Test Apex trigger on Case before update

Im stuck, how can I test the Apex trigger frfing on case before update? Any help appreciated. Im quite new into this universe so I bear in mind :-) Apex trigger: trigger CaseEscalationTrigger on ...
2
votes
2answers
59 views

Need to fire trigger on child objects when parent object is updated

I have a 1-to-many relationship using a lookup. I have a trigger that does a rollup on the parent object. So, anytime a child record is inserted, updated or deleted, the trigger fires and updates ...
1
vote
3answers
78 views

Trigger to update a picklist field from another picklist field

I'm still pretty new when it comes to Apex, so I apologize in advance if this is an easy thing to fix. I'm trying to create a trigger that auto populates a picklist field in the Lead object, based on ...
1
vote
2answers
40 views

What is wrong with this apex trigger to cascade address updates?

I've only just started using apex so I'm having trouble pinpointing what is wrong with this code. It is a trigger on accounts which is intended to cycle through all contacts belonging to an account ...