Creating Activity on insertion of record using trigger in Salesforce

Add the Activity related lists:

Sample Trigger:

trigger EmployeeActivityTrigger on Employee__c (after insert) {
    List<Task> listTask = new List<Task>();
    for(Employee__c emp : {
        Task tk = new Task();
        tk.WhatId = emp.Id;
        tk.Description = 'Conact the employee';
        tk.Subject = 'Employee Created on ' +;
    insert listTask;


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit