0

enter image description hereI'm new to Salesforce development, I have a requirement to populate Task Subtype Field on task with 'Call' when ever a task is created with Account. This can not be done with workflow field update. If possible can any one provide me with a Sample trigger that populates value in task Subtype.

  • you can try with process builder and if you face any issues, post it here – Santanu Boral Dec 4 '17 at 17:58
  • Does not work even with process builder. – Shravan Arolla Dec 4 '17 at 18:08
  • can you post a picture how you are trying – Santanu Boral Dec 4 '17 at 18:10
  • Add Screen shot for Process Builder. i'm not able to find the Field 'Task Subtype' when trying Field update or Record update – Shravan Arolla Dec 4 '17 at 19:14
  • 2
    The issue might be that Task.TaskSubType is not updateable per the SObject reference - since WFs and PB cant just operate on New records, there is an implicit assumption that the available fields need to be updateable as well as creatable – cropredy Dec 4 '17 at 22:19
0

You are definitely missing something as the field is accessible and here is a screenshot I took to guide you -

enter image description here

You should check to see Field Level Security and make sure you have access to that field or if the label has been changed in your org.

0

Task.TaskSubtype is createable, but not updateable. This means it's amenable to being populated only at the time of the record's creation, without firing an update DML operations. Practically, that limits our options to the before insert trigger.

You can do this, for example:

trigger TaskTrigger on Task (before insert) {
     for (Task t : Trigger.new) {
         t.TaskSubtype = 'Call';
     }
}

and it'll work just fine... mostly.

The "mostly" has to do with how the Lightning Chatter publisher inserts Tasks. It doesn't populate the TaskSubtype field until some point between the before insert and after insert triggers, which means that you cannot see the TaskSubtype of a Task inserted via the publisher in your before insert trigger, and any changes you make to it get overwritten by the system.

Once you reach the after insert trigger, the field's already been "created", and it cannot be updated, so you no longer have the ability to modify it.

While I have not tried updating TaskSubtype in Process Builder, based on its position in the order of execution, I would not expect it to work.

(I have written a post on this subject).

-1

It can't be done. Upvote this idea -

Make TaskSubType editable

There is a new field on Task called TaskSubType. It would be very useful if this field was editable.
There is an important reason for this:
In LEX, tasks are filterable dependent on their TaskSubType value (Filter timeline) and the task also displays a different icon accordingly. We have emails imported into Salesforce as tasks from a 3rd party product and they appear as ordinary tasks as opposed to Emails.
Please allow us to edit this field!

  • It can be done, but only at the time of insertion. The field is createable, but not updateable. – David Reed Aug 21 '18 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.