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

learn more… | top users | synonyms

2
votes
1answer
12 views

Trigger is covered by tests, but can't create package because it isn't covered

I'm in charge of managing packages of an app my company is creating, and I'm facing one of those 'Salesforce bugs' that don't tell you what is wrong. In the app we have some triggers, and when trying ...
1
vote
2answers
31 views

Trigger and Test Class Help

Can someone help me with this trigger/test class. I am trying to create a contract when the status of a DocuSign = Completed. trigger CreateContractDocSignComp on dsfs__DocuSign_Status__c (after ...
0
votes
2answers
22 views

How to handle trigger recursion

I have two objects A(parent) and B(child) related by a lookup relationship. I need to update records in object A using data loader. There is an after update trigger on object A which updates some ...
1
vote
1answer
29 views

Governor Limits Across Object Triggers

I am architecting a solution and wanted to know whether information exists regarding the depth of governor limits, when a trigger invokes another trigger (different objects). For example, I have 2 ...
0
votes
1answer
23 views

Record Access Issue on After Insert Trigger [duplicate]

A Community User is trying to create a record in a Custom Object, this trigger autofills the account lookup and the account owner is made this custom object owner as well. Object Level Permission, ...
0
votes
1answer
21 views

Email to Case Attachment Reassign

trigger emailAttachmentVisibleOnParent on Attachment (before insert) { for( Attachment a : trigger.new ) { // Check the parent ID - if it's 02s, this is for an email message ...
0
votes
0answers
20 views

Triggers on DuplicateRecordSet and DuplicateRecordItem

I'm trying to write an after insert trigger on DuplicateRecordSet and DuplicateRecordItem but the triggers never fire. Does anyone know if it is supported and how it can be done?
2
votes
0answers
14 views

Timing issues with PB/Flow and new records

When an opportunity meets certain criteria, I need to generate a PDF and attach it to the opportunity record. While it works on existing records, I'm running into a problem on new ones. How I'm ...
1
vote
1answer
57 views

How can I not update records using this Upsert?

I am attempting to create a new child record for each value of the multi-value field. I can only get the following code to create a new child record for the first entry into the list : //Data fields ...
1
vote
0answers
23 views

Why is WhoId null for task created by email from Outlook plugin?

I developed a simple trigger to fire before insert on task hoping to capture the whoId for the completed task that is inserted from using the Side Panel in Outlook. I am trying to get WhoId for the ...
2
votes
1answer
47 views

PDF Generation Salesforce

I'm kinda stuck in the middle of all the limitations Salesforce has for creating a pdf out of a Visualforce page. What I have is a Visualforce page that takes some parameters and I use to rerender as ...
0
votes
2answers
34 views

Simple trigger unit test, still getting 0% code coverage

The trigger: What I have been trying for the test class: I am a total noob when it comes to writing these unit tests. I would greatly appreciate any guidance to help me get this figured out.
-2
votes
2answers
37 views

How to bulkify this trigger m new to salesforce

trigger CreatingPayments on Payment__c (after insert,after update) { list<Test__c> MD=new list<Test__c>(); for(Payment__c op:trigger.new) { list<Test__c> MD1=[SELECT ...
0
votes
1answer
27 views

Test Class AssertEquals not finding correct value

I am encountering something odd with this test class, and I either do not know how to phrase my issue, or it is just odd. I have 2 triggers that I am checking. The first trigger is on an Opportunity. ...
0
votes
1answer
21 views

How to prevent users from deleting contacts but allowing merging of contacts

Need the ability to prevent users in a profile to be able to merge contacts but prevent them from clicking on delete button from contact detail screen and from related lists. In before delete event, ...
3
votes
2answers
90 views

How can I map a relationship between 3 sets of Values?

Is there a way that I can create some type of Map between 3 objects in a trigger? I need to map (sObject, Date, Decimal) I know this may not be possible in a single map, but is there a workaround ...
0
votes
0answers
21 views

Trigger need to set for the below issue [closed]

I had created CREATE JIRA button into CASE & want to set some condition. Type (Picklist) - Containing Values --> A, B, C, D If Type (Picklist) = B and saves the record and if user will click on ...
4
votes
0answers
44 views

Trigger Design Question - Help Appreciated

A bit of context: Our company sells vacation rentals and has over 60 properties. When a customer chooses a property, it is stored in a look-up field called Lead.Property__c. They will also choose ...
0
votes
1answer
14 views

Field is not writeable: OpportunitySplit.SplitOwnerId

I'm trying to update the SplitOwnerId whenever Opportunity Owner changes, on 'After Update' Opportunity Trigger. But I'm getting the error as FATAL_ERROR|System.SObjectException: Field is not ...
0
votes
1answer
15 views

How to write a test class for email messaging

I have written a trigger which will fire email messaging. Can anyone help me out how to write a test class for this. trigger taskEmail on Project__c (after update ) { set<String> projName = ...
0
votes
1answer
38 views

Trigger SOQL Question

I have a SOQL query that puts values into a map. In the main function of the trigger,(which lives within a for loop) I would like to clear() the original map, and re-run the same SOQL query, resulting ...
0
votes
1answer
15 views

upon checking checkbox field on parent need to check child records exist or not

I Have a Parent Account object in this i have check box field "No Asset exist". when ever i am trying to check the checkbox it need to show error message if Assert records exist for this Account ...
0
votes
2answers
21 views

Trigger to create a new child record type Opportunity and Opportunity Line Items if the parent record type Opportunity is Closed Won

Okay guys, I have now spent 4 days and counting on this trigger and I really feel it shouldn't be this hard but I am having a lot of trouble trying to get it done so help would be greatly appreciated! ...
-2
votes
0answers
23 views

trigger not working on after insert

Error: Invalid Data. Review all error messages below to correct your data. Apex trigger add_adress caused an unexpected exception, contact your administrator: add_adress: execution of ...
1
vote
1answer
45 views

Trigger Executing Only One Loop with Same Criteria

I (attempted) to write a trigger after insert of a new task that queries for the first activity date, most recent call date, and count of calls, then saves those values to the lead. When looking at ...
0
votes
2answers
28 views

How to add values to a Map?

This is my code: If(OppLineItems.size() > 0) { insert OppLineItems; for(OpportunityLineItem OppLI : OppLineItems) { Map<Account, ...
-3
votes
1answer
17 views

From Salesforce JIRA issue will Automatically Create

I want to set the some condition in Salesforce CASE. Whenever user click on the "CREATE JIRA" button in case, the JIRA issue will automatically create into the JIRA tool. It is possible to do this ? ...
0
votes
0answers
30 views

Write Update statement on a table in after update Opportunity trigger [closed]

I'm trying to update the Opportuntiy split table on after update trigger when we are changing the owner. I want to know how to write an update statement on table.
0
votes
1answer
24 views

Incompatible value type id for Map error

Anyone know why this keeps throwing an error? list<Account>Dealerships = new list<Account>(); map<Id, OpportunityLineItem> Opp2Deal = new map<Id, OpportunityLineItem>(); ...
0
votes
1answer
41 views

Is this trigger working how it is required to?

What this trigger is to do: Get a related list of Opportunity Line Items IF the stage on Opportunity = Closed Won. Once I get this related list, I need to create a new Opportunity with the account ...
0
votes
2answers
27 views

Map.put error - getting unexpected token error

This is the code I am using: trigger ParentOppToChild on Opportunity (after update) { List <Opportunity> oppQueryResults = new List <Opportunity>([Select ID, (Select ID, ...
1
vote
3answers
107 views

List not empty after deletion

I have a Test Class which retrieves a list of junction object records, created earlier in the Class & deletes them. List<SellerxProperty__c> sxpJosToDel = [SELECT Id, Property__c FROM ...
0
votes
3answers
41 views

Help with apex trigger that deletes Lead when related Account is created

Basically, I need to delete a Lead record when there is a new account created with the same name and email address. All our new accounts are automatically created through our internal system. Hence, ...
1
vote
1answer
35 views

Trigger to get related list of Opportunity Line Items and create a new Opportunity

I am having some trouble with writing a trigger to get a related list of Opportunity Line Items IF the stage on Opportunity = Closed Won. Once I get this related list, I need to create a new ...
0
votes
1answer
37 views

APEX TRIGGER to update a custom field of custom object when a new case record is created

I'm new to Apex and need a help regarding Triggers. I need to update a field(field__c) in custom object (obj1__c) (field of type checkbox) whenever a new record is created in case using email-to-case ...
0
votes
2answers
19 views

Opportunity - Contract Data issue

Hi I am facing the below issue, please help me Opportunity-Contract I had set the trigger, when opportunity stage is Closed Won automatically contract is created. Once contract will create the ...
2
votes
1answer
26 views

Trigger not updating the field

I'm trying to build a trigger that will take the value of a Child Object on the Opportunity and write that value to a field on the Opportunity Level. There are no errors and it seems to run ...
0
votes
1answer
43 views

Callout from Apex Trigger

I have a requirement with the following functionality: Before the Opp stage gets updated to Closed-Won on ever opp I should be able to push the opp info to an external REST webservice URL as JSON ...
0
votes
1answer
20 views

How to access OrderItems that are in a related list on Opportunity

The related list on opportunities contains records of order items which usually have an account name associated with them. I have a requirement where if an opportunity's stage name is 'closed won', I ...
1
vote
0answers
15 views

How to add custom buttons to article type page layout?

I need to have a button in the article type page layout that creates a chatter post with some text pre-populated. Best case scenario I would have a button in the toolbar next to Follow for "Feedback". ...
5
votes
1answer
178 views

Can I Bulky this further?

Is there any way to bulkify this more? Here is the code trigger CreateCampaignMemberBulkify on Contact (after insert,after update) { // Creating a container List<CampaignMember> allCM ...
0
votes
2answers
28 views

Trigger to Tie a New Lead Back to Campaign

we are using a system that integrates with Salesforce called Hubspot that generates contacts and leads. How it works is that when a Hubspot form is filled out, the entry is brought into salesforce. If ...
0
votes
0answers
27 views

Trigger error message when user clicks Submit for Approval button

I have recently encountered an issue, which do not seem to be resolve. I have set an approval process when the Current user:manager not equal to null and I have trigger with a helper class. When the ...
0
votes
2answers
26 views

read url data in rest integration

Through REST API I am capturing url for a particular image now,I want to read the data from that url in blob format and then attach that image in sales force , can any please help to read the data ...
0
votes
1answer
16 views

having problem writing trigger for custom objects where if i save a recrd in negotiations it should be saved to other custom object player

i have negotiations as a custom object with 2 record types sales negotiation & purchase negotiation i want to write a trigger such that if i save any player name in purchase negotiation it should ...
0
votes
2answers
30 views

Not able to delete inactive record

I have a custom checkbox on Contact and I am implementing something like: if the contact is edited AND the checkbox (api name active __c) is not checked then it should be deleted. I have written ...
3
votes
2answers
28 views

Assertion keeps failing in test class

I keep getting an assertion failure with my test class for the following trigger: trigger WebToCaseCountry on Case (after insert) { Set<String> countries = new Set<String>(); ...
2
votes
2answers
27 views

How to differentiate trigger update versus manual user update

I have a trigger that updates a lead field: Rate_Total__c. I also need the ability for all users in the organization to overwrite the Rate_Total field. But because the trigger's main purpose is to ...
2
votes
1answer
28 views

How do I add a manual over-ride into my trigger?

In a nutshell, when any user in my organization manually updates the lead field Rate_Total__c, the trigger should never fire again on that lead. Even upon future updates, the trigger should no longer ...
0
votes
1answer
15 views

Trouble with writing a test class for this Trigger

I am trying to write a test class for the following trigger: trigger WebToCaseCountry on Case (after insert) { Set<String> countries = new Set<String>(); for (Case c : ...