Questions tagged [apex-trigger]

Apex trigger is Apex code that executes before or after operations with Standard or Custom object.

Apex trigger is Apex code that executes before or after the following types of operations:

  • insert
  • update
  • delete
  • merge
  • upsert
  • undelete

on Standard or Custom objects.

47 questions
0
votes
0 answers

Restrict more then 2 contacts that saved on Account object

I want to build a trigger on contact, that accept check box. And In Account object it take 2 contacts that are active. when user assign 3rd active contact to the same account he/she will get error messege. how can it possible? i completed all codes…
0
votes
0 answers

deploy source to org in salesforce

I tried to deploy an apex trigger to my salesforce org and I got this error: "Invalid type: Schema.Language_Course__c " the apex file: "trigger LanguageCourseTrigger on Language_Course__c (after insert, after update, after delete)…
0
votes
1 answer

Best approach to update a field in Parent object if any update is happening on either of the object

I have to 2 object having master-detail relationship.  I want to update a Status picklist field in Parent object if any update is happening on either of the object (Parent or child). What will be the best approach?
0
votes
1 answer

Test Class For Appval Process Salesforce

I create this controller to diplay on a visualforce page a custom approval related list of record with the signature (photo) of Actor for an object Called Car_Maintenance. It works perfectly on my sandbox but i have trouble to write the test Class…
gbij
  • 1
  • 2
0
votes
1 answer

Update Parent Object Field in Apex Trigger

I have three objects 1)Truck__c 2)Booking__C 3)Payment___C. Truck and Booking has master detail relationship where Truckk is master and Booking is detail. Booking and payment has lookup relationship where Booking is parent and payment is child. I…
unflagged.destination
  • 1,576
  • 3
  • 19
  • 38
0
votes
1 answer

Automate user creation and deletion through external API requests

I have 0 experience in coding in APEX so I would greatly appreciate your help and support with this question! I would like to figure out a way to automate the deletion of an Aircall User if an SF user is deleted. Let us assume that every SF user has…
0
votes
0 answers

Apex Code to get input value from opp using before insert trigger

Hi Everyone help me to get output. WHERE shipDate__c >= :startDate AND return_date__c <= :endDate In the above code startDate & endDate retrives the data (already Inserted Record) from db. for eg: startDate = 20-03-2021 endDate = 16-04-2021 WHERE…
0
votes
1 answer

Salesforce -Fire apex trigger only after complete data load

So here is the issue We are loading data into a CustomObject__c using DataLoader. Usually the no of records that are passed are 3. Also, if there is any issue with the data passed, they run the dataloader again and pass the corrected data. Now, the…
0
votes
0 answers

React native remote notification

I am trying to send a mobile push notification to my android device based on apex trigger, and I didn't see notification banner but in console I can see onNotification event fired and I can see my payload info. I have followed In react native app…
0
votes
1 answer

How do I auto-populate desired fields in a new object form with triggers after clicking on "Save & New" button?

I'm fairly new to Salesforce and I'm trying to auto-populate a couple of custom fields in an object when creating a new one when I click on "Save & New" to make the process more userfriendly. For example, the first time I'll fill in a serial number…
0
votes
2 answers

Access "Page Items to Submit" values inside a trigger in oracle apex

I want to access extra page item value from a trigger which isn't in the related data table. For an example I have a table like below, Employee ---------------------- empId | fName | lName ---------------------- 1 | John |…
Pumayk26
  • 537
  • 10
  • 28
0
votes
1 answer

Attempt to de reference a null object error

On line acct.AmountX__c += amtX this and acct.AmountY__c += amtY this it is giving me an error. The trigger is on after insert and after update. When i am inserting any record in contact then it is giving me an error i don't know why. Why should…
0
votes
1 answer

Why this is invoking another trigger? Is there any referencing problem? It is giving a DML exception that update failed

public static void hireContactForm(List < HireForm__c > HireList) { List < Contact > contList = new List < Contact > (); List < Case > CaseList = new List < Case > (); //List hireInsertList = new List(); for…
0
votes
1 answer

Apex extracting fields from a trigger to create a custom JSON

I have created a trigger for Order Object and only want specific fields to be pulled from that object to create a custom JSON data structure. I have tried saving the fields that I need from the object into local variables, placing them into a list…
0
votes
1 answer

Need optimization of this trigger?Can anyone help me out.?

Actually, I am trying to get Area_c field from custom object(Zip Codes) into the lead object custom field Area_c. So, I have written some of the code but is there any other way to write it or get some optimization of this code. trigger…
Sanny
  • 3
  • 1