I'm trying to append a list of IDs from list B on list A, I need this to be done on a single column on list A. I created a multiline field with rich text and append feature on sharepoint.

How can I append it using javascript?
We usually use oListItem.set_item, is there anything like oListItem.append_item?

On list A we receive some IDs from list B, it would be nice to have them as hyperlinks.

I tried so far to get all the required IDs on an array and set the array on the field, but it's returning System.Object[].

Could you please help me? Thank you all!

Edit: I tried to use this `var hyperLink = new SP.FieldUrlValue();

  for(var i = 1; i < IDS.length; i++) {
    hyperLink.set_url('DispForm.aspx?ID=' + IDS[i] + '&ContentTypeId=0x0100F1FB54AE90F5084EBCB22D2C63042C45');
    hyperLink.set_description('ID: ' + IDS[i] + " ");
    oListItem.set_item('comentariosAdicionais', hyperLink);

but for some reason it returned this LAST FIRST NAME(18/02/2019 12:46): /DispForm.aspx?ID=6&ContentTypeId=0x0100F1FB54AE90F5084EBCB22D2C63042C45, ID: 6

edit 2: Solved it setting Hyperlink directly on oListItem.set_item("fieldToBeSet", <a href="link here">hyperlink</href>

  • Why don't you use a lookup field? – Salah Feb 18 at 14:35
  • Never really used lookup field before, i'm getting everything with coding with javascript. How could I do it? – Eddie Feb 18 at 14:52
  • Since you have solved your problem. Nevermind. But you should know that a lookup field (that allows multiple values) is what you were looking for. – Salah Feb 18 at 15:20

Your Answer

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

Browse other questions tagged or ask your own question.