0

My client has requested if we can replace the 'View Entries...' text with the first line of the multiple line of text value (or any extract of the text).

The below screen shot is off a all items view.

enter image description here

are there any workarounds?

1

You should be able to achieve what you want using SharePoint's Client Side Rendering (CSR). BUT, I have never used CSR with a multiple line text field, so you will need to see what the output is and probably tweak.

function CSR_Setup() {
    var overridectx = {};
    overridectx.Templates = {};
    overridectx.Templates.Fields = {
        "Column1": { "View": CSR_ShowText }
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overridectx);
}

function CSR_ShowText(ctx) {
    var fieldText = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    return fieldText;
}

SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", CSR_Setup);

You will need to change Column1 to the internal column name of Subject and Amount (QAR).

It might also be worth trying to change the first line in the CSR_ShowText function to this if the output is not as desired:

var fieldText = ctx.CurrentItem.FieldValuesAsText[ctx.CurrentFieldSchema.Name];

As I say, never tried this with a multiple line text field but I hope this puts you on the right track!

0

If a workflow is an option, a SharePoint Designer workflow can easily do this.

  1. Add a new Single Line of Text column to the list to display the text. (Named "MultiResult" in my examples below.)
  2. Create a 2013 style workflow on the list.
  3. Add an "Extract Substring from Start of String" action.
  4. Set the number of characters to extract. (max of 255)
  5. Click "string" and click "fx".
  6. Select "Current Item", your Multiple Line of Text field, "Plain Text" and click OK. (If you don't select "Plain Text" you will also get the HTML from the column.)
  7. Add a "Set Field in Current Item Action" and set the output column to the variable value. (The "Log" action in the example below is optional, but handy for debugging.)
  8. Click Workflow Settings in the ribbon and set how you want the workflow to run.
  9. Publish the workflow and test.
  10. Modify your views to display the new "result" column.

enter image description here

enter image description here

0

The "View Entries" usually means that your list has version history and the multi line text field has appending comments. In some cases it may not always contain text at all if the column is optional. It is for this reason that the text is replaced with a link because appending multi line text fields have modified and modified by stamps included with the version history for the item.

If the Multiline text field had appended changes to text set to "No" you would see the text right in the view as expected.

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.