Truncating Characters in Body Column of Announcements

// November 10th, 2008 // Sharepoint

There are few options available in order to do this.

You can try the following:

1) Create a new column “TrimmedBody” of type Text and limit the number of character to say 10 or whatever works for you.
2) Open a Sharepoint Designer and Create a new workflow on your List. Set workflow to start automatically when new item is created.
3) Add one action i.e. “Set Field in current Item”. Select TrimmedBody in field selection and select Body in value selection.

You action should look Set TrimmedBody to Announcement:Body  (where Announcement is name of the list)

See if this works because of the character limit on TrimmedBody Column. (It did not work for me. Despite the fact that I set character limit to 10, it workflow copied all the text from Body. :))

In order to rectify this problem, I just created another column(”CalculatedBody”)of type calculated and my formula looks like this:

=LEFT([TrimmedBody],10)

This should work. There are other ways to do it as well, for example:

1) You can also check Paul’s codeplex utility which provides custom function.

2) You can use event handler on the list which will trap ItemAdding event of the list and update the list item, but then you will have to write the code deploy the event handler etc.

3) You can use VS workflow, and that way, you have more flexibility in terms of writing code.

Leave a Reply