+ Start a Discussion
Andrew Hoban 6Andrew Hoban 6 

Apex/Process Builder - Create Case When Task Created and Populate the Related To field with the Case Id


Is there a way, either through apex/process builder, to create a case when a task record is created and populate the newly created case record in the related to field?

Sainath VenkatSainath Venkat
@Andrew Hoban,

You can achieve this with a simple process builder.

Just goto process builder then in object Select "Task" then in criteria just give name and select No criteria—just execute the actions! Then in immediate actions select "CREATE A RECORD" in add action then in RECORD TYPE Select Case then in fields just map case fields to whatever task fields you want.

Then activate it.User-added image

Mark it as best, if it solves your problem.
Andrew Hoban 6Andrew Hoban 6
Hi Sainath. 

The issue is that when the case is created, I require the case id to be updated on the task record. The process builder you have sent over simply creates the case, but there is no relationship to the task record. Do you know if this is possible?
Sainath VenkatSainath Venkat
Then simply create a lookup relationship from case to task, so task will be parent and case will be the child here, map the lookup field with Task record I'd from process builder in fields section and add case related list to task page layout and you will have all the cases that were related to a particular task.
Andrew Hoban 6Andrew Hoban 6
I dont believe you can create a lookup relationship on Case to the task object? 
Sainath VenkatSainath Venkat
yeah, we can't create lookup here but I don't see any other option available here to attach a case to a task.