function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sudha76sudha76 

Task Description cannot be pulled into the related list properties due to the field type

Based on the current limitation which is Task Description field of TASKS object, cannot be pulled into the related list properties due to the field type ie - Long Text Area, I need to come up with some kind of customized solution to display the first few lines of this field on the realted list view page.

 

The challenge is, I tried using the Formula field on the activity custom field, but "Description" standard field is unavailbel for any field updates.

 

So seems I cannot use Formulas to capture the lines from this field .

 

The Goal is to display a field on related list view which displays first few statements from the Description field, so that the Sales Team can glance the updates.

crop1645crop1645

Two options come to mind

 

1. Create a separate text field (not a formula): short_description__c;  Use a before insert/after trigger to copy the first n chars (say, up to 255) from description to short_description__c

 

or

 

2. Create a separate text field (not a formula): short_description__c;. Use a workflow rule that executes any time Task is created or edited and a field update to do the same as option 1 (use the LEFT function to get the first xx chars)

sudha76sudha76

Thanks.

 

But the WF Rule will not work in this case. When you create a WF Rule on Tasks, and try to do a Field Update, you will notice the Description field is not even available for the Field update.

sudha76sudha76

The Trigger may work where I can copy the first few lines from the *Standard Description Field* over to the *custom field called Short_Description__c*.

 

Any examples on such Trigger on how to copy values in between fields?

crop1645crop1645
trigger TaskTrigger on Task (before update, before insert) {
for (Task t: Trigger.new)
  t.short_description__c = t.description != null ? t.description.substring(Math.Min(255,t.description.length()) : null;
}

 assuming short_description is 255 max chars when you define the custom field