last modified date of a custom object -- w3web.net

Trigger to Update the Custom Last Modified Date Field in the Parent Object When the Records in the Child Object is Updated Using Apex Trigger in Salesforce | How to get the last modified date of a custom object in apex trigger

779 views

Hey guys, today in this post we are going to learn about how to update the Custom last modified date field in the parent object when the Records in the child object is updated using Apex Trigger in Salesforce.

Real time scenarios:- Write a trigger on Child object and update the custom Last Modified Date Field, LastModifiedDate__c (Date/Time Type) in the Parent Object When the Records in the Child Object is Updated.

parentObjTrigger:- Custom Fields & Relationships

Create a custom field on parent Object name as LastModifiedDate__c (Date/Time Type).

childObjTrigger:- Custom Fields & Relationships

Create a lookup relationship field on child Object name as childLookup__c :: Lookup(parentObjTrigger).

Files we used in this post example:-

LastModifiedDateTrigger.apxt Apex Class Trigger It will be fire whenever update a record on child object

Parent Cusotm Object:- parentObjTrigger__c

Custom Field:- LastModifiedDate__c

Lightning Component Trigger on child custom object and update the custom Last Modified Date Field in the Parent Object Whenever the records in the Child Object is changed.

Child Custom Object:- childObjTrigger__c

Custom Field:- childLookup__c : Lookup(parentObjTrigger)

Child Object with Custom Lookup Field childLookup__c : Lookup(parentObjTrigger) field it is help to communicate between parent object.

Final Output

Update the Custom Last Modified Date Field in the Parent Object -- w3web.net

Other related post that would you like to learn in Salesforce

Step 1:- Apex Class Trigger : LastModifiedDateTrigger.apxt

 

Further post that would you like to learn in Salesforce

 

 

FAQ (Frequently Asked Questions)

What triggers last modified date Salesforce?

LastModifiedDate is automatically updated whenever a user creates or updates the record. LastModifiedDate can be updated to any back-dated value if your business requires preserving original timestamps when migrating data into Salesforce.

How do I change the last modified date in Salesforce?

Created Date and Last Modified Date fields in Salesforce objects are audit fields and we can't edit or change these field directly or through code. You have to contact salesforce support team for them to grant permissions to you to edit or change these fields if needed.

What does last modified date mean in Salesforce?

Last Modified is the date and time stamp for changes (for example, changes to a phone number or an address) made to an individual record. This also shows the User who made the change. Last Activity shows when someone in your Organization last did something related to the record.

  • Your reaction of the article ▾
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

8 thoughts on “Trigger to Update the Custom Last Modified Date Field in the Parent Object When the Records in the Child Object is Updated Using Apex Trigger in Salesforce | How to get the last modified date of a custom object in apex trigger”

  1. You’re a beautiful inspiration. It really helps me in any situation. Where I stuck. Many of my friends told me to comment there post but I stuck what I should comment. Finally I got your post it always help me. Thanks for the lovely post.

    Reply

Leave a Comment