I have two workflows in theory, one that creates a task under certain conditions for a user in Department Finance and another that creates in certain conditions a task for a user in department Sales. I understand that the task record type is selected by the context user of the workflow, ie.., the user that was logged in for which the workflow rule was executed. If for this scenario the context user's default task record type is type finance, then both workflow rules will create tasks of record type finance even one of them needs to be record type Sales. How would I get each workflow to generate a task based on the record type required by the worklfow, finance type task or sales type task and not the default of the context user.
There's only a limited number of Task fields you can fill from a Workflow, e.g. subject, status, priority, comments. RecordType is not one of them, as you must have found out :-)
So I see 2 options:
- build a workflow with field update based on the Task's subject. Subject 'Finance' -> assign recordtype 'Finance'. Subject 'Sales' -> assign recordtype 'Sales'. This will work as long as it doesn't interfere with 'normal' tasks. You could use Status to distinguish between Tasks created by Workflow and 'normal' tasks. Then update the Status to the real status together with the RecordType update.
- Write an APEX trigger in which you create the task and also build rules for assigning the correct recordtype to the task.