You need to sign in to do that
Don't have an account?
Katie Hamberg
Task Record Type
Is there a way to have the Task Record Type of an auto Task be based off of the Subject of the Task rather then the default of the Task creator?
Thanks!
Thanks!
PS: if this answers your question then hit Like and mark it as solution!
I'm not actually looking to just create a new task record type. Sorry if I wasn't more clear in my previous message. For example right now we have two task record types, Type A and Type B. For all of our user Profiles, Type A is their default record type. We currently have a workflow rule set up on Cases, so when a certain picklist is selected, it creates an Auto Task with a Type A Record Type. However, we would like to have this Auto Task in particular always be created with a Type B record Type. Is this possible to do with a trigger?
Thanks!
PS: if this answers your question then hit Like and mark it as solution!
Create a Workflow rule on Task object.
You can refer to the creenshot below.
You can then create the "Field Update action" to change the recordtype.
Thanks,
Pratik
P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
You can refer to sample Workflow to change Task recordtype:
1. Workflow Rule
2. Workflow Field update to change Recordtype:
3. Lastly Activate the Workflow Rule by clicking the "Activate" button.
Thanks,
Pratik
P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
Thank you both for your responses! However, I tried that solution already and it didn't work. One of our contractors created a trigger like this that changed the task record type based on a picklist value from another custom object. I tried to play around with it, but couldn't figure it out.
List<Task> tskList = new List<Task>();
Task tsk;
set<Id> pId = new set<Id> ();
Map<Id,Proposal__c> Pmap;
Schema.DescribeSObjectResult R = Task.SObjectType.getDescribe();
Map<String,Schema.RecordTypeInfo> rtMapByName = R.getRecordTypeInfosByName();
Schema.RecordTypeInfo rtByName = rtMapByName.get('Inspection');
List<Measures__c> measureList = new List<Measures__c>();
Measures__c measure;
User u = [Select Id, Name from User where Name like 'Scott Durrett%' limit 1];
for(Related_Measures_and_Proposals__c relM : [Select Proposal__r.Stage__c, Proposal__c, Measures__r.Measures__c, Measures__c ,Measures__r.Measure_Status__c From Related_Measures_and_Proposals__c where Id IN : Trigger.New]){
if(relM.Proposal__r.Stage__c.equalsIgnoreCase('Bid Approved')
&& (relM.Measures__r.Measures__c.contains('Air Sealing') || relM.Measures__r.Measures__c.contains('Window Replacement'))){
tsk = new Task(WhatId = relM.Proposal__c, Subject = 'Air Sealing Inspection', RecordTypeId = rtByName.getRecordTypeId(), OwnerId = u.Id, Status = 'Not Started', Priority = 'Normal',Description = 'Schedule QA/QC inspection of air sealing prior to insulation being installed and update the Rating and Pass/Fail fields in this task',
ActivityDate = Date.today().addDays(7));
tskList.add(tsk);
}
if(relM.Proposal__r.Stage__c.equalsIgnoreCase('Construction Started')
&& !((relM.Measures__r.Measures__c.contains('Air Sealing') || relM.Measures__r.Measures__c.contains('Window Replacement')))){
tsk = new Task(WhatId = relM.Proposal__c, Subject = 'Inspection', RecordTypeId = rtByName.getRecordTypeId(), OwnerId = u.Id, Status = 'Not Started', Priority = 'Normal',Description = 'Schedule QA/QC Inspection and update the Rating and Pass/Fail fields in this task',
ActivityDate = Date.today().addDays(7));
tskList.add(tsk);
}
if(relM.Proposal__r.Stage__c.equalsIgnoreCase('Bid Approved')){
measure = new Measures__c(id= relM.Measures__c , Measure_Status__c = 'Bid');
measureList.add(measure);
}
if(relM.Proposal__r.Stage__c.equalsIgnoreCase('Construction Started')){
measure = new Measures__c(id= relM.Measures__c, Measure_Status__c = 'Construction');
measureList.add(measure);
}
}
if(measureList.size() > 0){
Database.update(measureList, false);
}
if(tskList.size() > 0){
Database.insert(tskList, true);
}
}