function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger autoCreateTask on Case (after insert, after update) { List<Task> insertTask = new List<Task>(); for(Case newCase : Trigger.new) { Task newTask = new Task(); newTask.subject = 'Automated Task'; newTask.whatId = newCase.Id; newTask.ownerId = newCase.OwnerId; newTask.status = 'In progress'; newTask.Priority = 'Normal'; insertTask.add(newTask); } if(insertTask.size() > 0) insert insertTask; }
You can create a task in two ways using Workflow and Apex trigger. Use the following code it will be work.
All Answers
- Create a workflow rule in the case object and set the evaluvation criteria as 'Every time created'
- Set your rule criteria (Condition when the record should enter) and click Save and Next
- Then in the workflow action choose New task.
To know more about Workflow rule, check this trailhead module - https://developer.salesforce.com/trailhead/force_com_admin_intermediate/business_process_automation/workflowThanks,
Karan
You can create a task in two ways using Workflow and Apex trigger. Use the following code it will be work.
plz write a trigger to count the contacts in contact object , that will disply on the number of contacts field on cotact object?