Similar Posts

24 Comments

  1. Great, solution but i’m having issues. Are there any other steps I’m missing this makes sense but is not functioning? Do I need to reference a javascript libarary? Thanks!!!

  2. Great solution Phil. To elaborate on Philips solution, I added a replace statement to remove the trailing semi-colon when more than 1 item is added. This is accomplished by getting the count of the number of semi-colons from the main string. Look for the replace statements near the bottom. Cheers!

    $(document).ready(function() {
    $(‘nobr:contains(“column2”)’).closest(‘tr’).hide();

    });

    function PreSaveAction() {

    var str = $(“input[id=’ctl00_m_g_d0f8683a_b3b6_4e79_875b_a18b15ca5b66_ctl00_ctl05_ctl01_ctl00_ctl00_ctl04_ctl00_ctl01′]”).val();
    var result = str.split(“;”);
    var finalresult = “”;
    var count = (str.match(/;/g) || []).length;

    //Clean metadatafield text. Remove guids
    $.each( result, function( i, val ) {
    var resultB = val.split(“|”);
    finalresult = finalresult + resultB[0] + “; “;

    });

    //Save output in Column2Name

    if (count > 0){

    $(“input[id=’ctl00_m_g_d0f8683a_b3b6_4e79_875b_a18b15ca5b66_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’]”).val(finalresult.slice(0,-1).replace(/;+$/,”));
    return true;
    }
    else{
    $(“input[id=’ctl00_m_g_d0f8683a_b3b6_4e79_875b_a18b15ca5b66_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’]”).val(finalresult.slice(0,-1).replace(“;”,””));
    return true;
    }

    };

  3. I’m in 2019 On Prom and here’s what I did:

    Create a multiline text field in your source list, call it “KeywordsCalc”
    In your PreSaveAction copy the data from the source metadata field to the multiline text field we created in step 1.

    var keywords = $(‘[id^=”Keywords_$containereditableRegion”]’).text();
    $(‘textarea[id^=”KeywordsCalc”]’).val(keywords);
    Create a multiline text field in your destination list to receive the data.
    In your workflow pass the data from the Multiline field in the source list to the multiline field in your destination list.

    This copies the data over without all the extra pipes and long numbers, ie: Keyword1;Keyword2;Keyword3; etc

    Of course, in the destination list you lose the connection to the term store but in my case I didn’t need it. But the keywords display exactly as desired.

    HTH

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.