I want to only show specific task fields when the type of task = a value.
I have created a Record Type and a new Page Layout for that record type. I have assigned the record type to the new page layout assignment also. However, I cannot see how to set criteria based on task fields.
Example: IF Task field
#Task ObjectType = "Expiring Subscriptions", THEN update page layout to Exp. Subs page layout.
1 个回答
If you are using a trigger, you can get the record types Id using:
ID taskRecordTypeId = Schema.SObjectType.Task.getRecordTypeInfosByDeveloperName().get('Record Type Name').getRecordTypeId();And now you can use it to assign a recordtype.
for(Task t: Trigger.new){
if(t.type = a){
t.RecordTypeId = TaskRecordTypeId;
}
}