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

Opportunity Trigger After Update doesn't work

So here is the scenario, I want to have an error message when user click Save after he changes Opportunity Stage from 10% Probability to 20% probability. I am using Related list Object Contact Role so ...
0
votes
0answers
5 views

Send Delegated Approver Email Notification when manager is on vacation

I am trying to create an automatic process that allows our managers to go into their user account and click a check box if they are going to be on vacation and set the start date and end date. Once ...
0
votes
1answer
17 views

Apex Trigger Creating Duplicate Chatter Post

I have an APEX trigger that posts when an opportunity is closed won. Great, problem is its posting twice. From what I've read I believe this is to do with the fact that there are workflows that are ...
0
votes
0answers
20 views

Duplicate check for geolocation [on hold]

Is it possible to find the duplicate Geo location (Latitude and longitude) through trigger on custom object.
1
vote
2answers
21 views

Trigger fails because of organization's code coverage?

I recently inherited our Salesforce from a more experienced admin with some developer skills...I am a new admin and have zero developer skills. I need to deploy a trigger that the previous admin wrote ...
0
votes
2answers
10 views

Error: Compile Error: Method does not exist or incorrect signature when attempting to use a method from a class?

I'm attempting to build my first test, which is for a trigger I am trying to push to production and running into a large number of issues. The first an foremost being that the trigger at the beginning ...
0
votes
4answers
22 views

Trigger to copy address based on Custom Checkbox

I am a bit of a Noob so this may be a Noob questions, but I am trying my first trigger to copy an address from the account shipping address into the account billing address fields when a custom ...
1
vote
1answer
18 views

Field is not writeable: Order.IsReductionOrder

I am trying to update Order.IsReductionOrder to true from a trigger but getting below error. Field is not writeable: Order.IsReductionOrder It looks like field is read only from Order ...
1
vote
2answers
42 views

Creating custom object for class roster that would pull a list from contacts

I am helping a local non-profit organization that does leadership training. They need to create a roster that will pull a list of contacts for the roster, and also store few topics that they worked ...
5
votes
2answers
26 views

Invoking Batch Apex in Update Trigger

I have written before update trigger on an object. In that trigger I am invoking batch Apex to update the same object records but in apexjob am getting error like this First error: Update failed. ...
0
votes
2answers
36 views

Need Trigger for before update account based on checkbox

In Account Sobject i have added two check-box's 1.Administrative Office and 2.Data Center when user enter name and check anyone of it then Account Name is like Sam (A)/(D). which i did with trigger ...
1
vote
2answers
13 views

Sending an email to a User defined from a lookup?

I have a lookup field on our Opportunities, that pulls a User in our Organization. I need to be able to email that specific user when the opportunity changes. I can already figure out how to make a ...
1
vote
1answer
17 views

Flows in Order of Execution

I have a flow which creates the Order record and also there is an after insert trigger on Order.I am trying to understand which one executes first I have assignment of Order shipping address on Fast ...
0
votes
4answers
29 views

Assign Account to Contact based on email domain

I'm writing a Trigger to assign an Account to a new Contact based on the email domain. I have two formula fields that strip everything but the domain (i.e. acme.com) so that I can match from the ...
1
vote
1answer
39 views

Using a trigger to set an application-defined “last modified date” for Case

Need a field on the cases that is the true last modifed date. So if we send an email, modify the case, or adds any activity or comment, this date field updates to NOW(). I need help with writing a ...
0
votes
2answers
18 views

How to detect the name or id of currently running batch job from trigger?

Managed code kicks off a batch job. I have a trigger where I need to do overwrite a field only when it's updated by this batch job. The only thing I could come up with so far is querying ...
1
vote
2answers
25 views

Error: Compile Error: Field is not writeable: WorkBadge.Description at line 18 column 9

Getting the Error ....Please help me solve this issue...I have to write in this object. trigger insertworkbadge on DriverEfficiency__c (after insert) { List <WorkBadge> vehToInsert = new List ...
0
votes
2answers
48 views

Trigger checkbox when Insert/Update

I would like to update the checkbox field 'New' to false when there's a new record inserted or updated when the colID is more than the previous colID. For instance: My record as shown: ProdID = 1 ...
0
votes
1answer
21 views

I have created a trigger, which generate's a random string, Please can any one help in writing the test class?

trigger setGuid on dftly_app_contact__c (before insert) { For (dftly_app_contact__c dac: Trigger.new){ Blob b = Crypto.GenerateAESKey(128); String h = EncodingUtil.ConvertTohex(b); ...
1
vote
1answer
22 views

What is the best way to structure the code in this case

Sorry for being not quite specific in the title but I find it really hard to describe the scenario in one sentence. Suppose I have two custom objects: A and B. In the triggers, trigger A calls ...
1
vote
1answer
21 views

Can we Access Multi-Currency Values from Custom Setting using Apex Trigger

I have a Standard Object "Opportunity" I want to access a custom-setting with multiple currency I have multi-currency enabled in my org. Generally a custom setting can be accessed like follows ...
1
vote
0answers
14 views

Do I need Trigger to display Read sign on email from cases?

I wanted to show that new email is arrived and read when it is received for any cases in salesforce. I tried workflow (Email Message: Is IncomingEQUALSTrue) AND (Email Message: StatusEQUALSNew) ...
0
votes
2answers
35 views

Trigger after insert, before update

Im trying to create a Trigger on my Products. Would like to update the New checkbox field to false if the col is more than the newly inserted col and if the checkbox field is true. However the trigger ...
1
vote
2answers
29 views

System.ListException: Duplicate id in list. But how come?

I am getting an error: System.ListException: Duplicate id in list. In my Trigger. But I really don't see a reason this should happen. Here is my code: Set<Order__c> ordersToUpdate = new ...
0
votes
1answer
40 views

One object has Two triggers with same Event After insert

I have Account object which have two Trigger, one trigger has events before insert and after insert second trigger has after insert event. So which trigger will fire after the record is saved ?
1
vote
1answer
41 views

Changing text field value based on formula and a picklist field, trigger?

I have a CSV that is being imported in SalesForce under Contacts. There are 6 fields for training program type and a year for each one. All are in text format and the data comes from a another system. ...
0
votes
1answer
28 views

Convert trigger to apex class

I have two custom objects. The first stores transactional data with a externally generated customer ID. The second custom object maps this customer ID to a salesforce account ID. I'm trying to find ...
0
votes
2answers
34 views

Bulkify my trigger - Quote Create

I have a trigger that creates a new quote when a new business opportunity is created, it works very nicely however I have requirement to create multiple quotes when the opportunity is created. 4 ...
0
votes
0answers
22 views

display the total no of JOBAPPLICANT records into respective JOB level as well as ACCOUNT [closed]

display the total no of JOBAPPLICANT records into respective JOB level as well as ACCOUNT level here JOB,JOBLEVEL,ACCOUNT are three objects and i want to use trigger logic
-2
votes
1answer
24 views

USING TRIGGERS Write a query to bring ACCOUNT record which has more than 100 CONTACTS [closed]

Write a query to bring ACCOUNT record which has more than 100 CONTACTS?HERE ACCOUNTS AND CONTACTS ARE STANDARD OBJECTS
0
votes
1answer
25 views

mobile phone and email field duplicate in account object

Hello Guys, I have wrote a trigger on account object that whenever a user enter duplicate phone number or email then it will show an error on page and the info will not stored in the ...
1
vote
1answer
63 views

Check if a string substring value is alphabet

I have a requirement to make string values passed as init caps. How to check whether the element I am capitalizing by toUppercase() is an alphabet or not? Please find my code snippet here. Snippet: ...
0
votes
0answers
22 views

Difference between capitalize and to Uppercase()

I have a requirement to make a string value passed as initial caps. Can someone let me know what can be demerits using .capitalize method instead of substring the first position and convert it to ...
0
votes
0answers
10 views

Update Phone field of account record with the Contact Phone field and delete both Contact and Account Record at a time

When ever we update “phone” field of Account record, then update the related Contact “phone” field with the updated Account’s “phone” field before update. & When we delete Account record then ...
1
vote
1answer
21 views

Amount change in opportunity

I'm trying to create trigger where if record type is Revenue Risk then amount should be saved in negative value, Here's my code in which I'm having error. I tried it two ways, second is in comments.. ...
0
votes
1answer
23 views

Is it possible to move a triggers such as BeforeDelete to a workflow or process? [closed]

Is it possible to move a triggers such as BeforeDelete to a workflow or process? What would be the best/most optimal design for such a case? Process objects are triggered on creation and edit, but I ...
0
votes
1answer
20 views

Change delegate user by trigger?

Please how can i get the delegate user changes by triggering some apex code ? I preferred to do it with a workflow but the pb is that workflow can't update field in a lookup relationship and we can ...
1
vote
1answer
11 views

Can't set Account on Case from Trigger

I need to be able to set the account on a case when the case is created. I have the following trigger. The debug statements show as expected, but the account is not getting updated on the case. What ...
1
vote
0answers
35 views

How to get values of existing record and use in new record in trigger? [closed]

How to get the values from other records in trigger.
1
vote
1answer
34 views

ERROR: SubscriberUpdateTrigger: System.LimitException: Too many future calls: 51

When updating 115 record through data loader, i got this error message. ERROR: UpdateTrigger: System.LimitException: Too many future calls: 51 Originally I thought it was because i was updating ...
-1
votes
1answer
25 views

After insert not updating the fields from contact BATCH CLASS [TRIGGER]

CLASS global class ModifiedDate implements Database.Batchable<sObject> { List<Contact> ctt = new List<Contact>(); String query= '[SELECT ...
1
vote
1answer
27 views

Field Validation Exception and Database Class vs DML Statements

I'm trying to write a trigger and having some real trouble in making it work. Background: we adopted the Country/State picklist "Feature" last year. All the cleanup wasn't done. We have some records ...
0
votes
1answer
14 views

Split functionality for consecutive occurence

I have below code snippet for making immediate letter after space in capital. But this fails for consecutive two spaces and throws error. Can some one guide me here? List<String> ...
0
votes
2answers
13 views

Ending position out of bounds

I have below trigger which passes string values to below class to do some changes for update. Please find the trigger. Trigger: trigger AccountFieldAutoUpdates on Account (before insert, before ...
0
votes
3answers
20 views

How can i create a trigger for my batch class i don't know how can i do it. [HELP]

global class ModifiedDate implements Database.Batchable<sObject> { String query= '[SELECT Id,Name,LastContact__c,CreatedDate FROM Account]'; global Database.QueryLocator ...
0
votes
1answer
12 views

When Activity Inserted by a User that matches User Lookup field on Account, The Date of the Activity is Put in CE_Last_Activity Field on Account

I have a trigger where I'm trying to make it work like the following: When a Activity record is inserted by a user that matches the value in a user lookup field on Accounts named "Customer Success ...
1
vote
1answer
58 views

Apex Trigger to Update Account Name on Contact

I have Contact records - of RecordType = AiM CR Writer - that when created I want the Account Name to automatically populate with a specific account. Here's the trigger I've written so far...This ...
2
votes
1answer
46 views

Triggered Send - passing nested data

Is there any good solution for sending nested (not flat) data to triggered send? Suppose I want to send a transaction confirmation email. Ideally, I would like to send a json (or json-like) object ...
0
votes
1answer
28 views

Need help to make trigger and VP

1.- Create an object called A, with a date field called DateA - Create an object called B, with a lookup field to A and a date field called DateB 2.- Create a trigger that will set the DateA field as ...
0
votes
0answers
33 views

Cannot capture debug logs for Duplicate Management trigger

Does anyone know how to capture debug logs for trigger execution on the new Duplicate Management object DuplicateRecordItem? I've set debug logs for myself, and the execution of the ...