0

I would like to display through the script editor the Content of one row in a parent site. For each row, I have a unique value, I would like to put it as an argument. I'm not a JavaScript expert, therefore I tried to adapt some code founded on Internet but doesn't work.

Thanks in advance.

1
  • I'm afraid I don't understood your problem. Please try to include your code snippets and the errors you encountered to help others help you May 22, 2018 at 15:16

2 Answers 2

1

When using JSOM to query list items, you must include the fields you want to read in your load statement.

This would change your line

clientContext.load(collListItem);

into

clientContext.load(collListItem, "Include('Title', 'TaskName')");

where TaskName is the internal field name.

Hope this helps!

4
  • Thank you, it's helped me. This is not correct for me (I already saw this solution before) but I search the documentation of the load function and it should be clientContext.load(this.collListItem);
    – fullcarton
    May 24, 2018 at 7:06
  • Is it possible to reach a list which is in the parent site ? I am trying, context = new SP.ClientContext(siteUrl) but no results
    – fullcarton
    May 24, 2018 at 7:19
  • This link should work May 24, 2018 at 7:23
  • It works it was just long to display because of the amount of data. Thanks for your replies
    – fullcarton
    May 24, 2018 at 7:24
0

Rigth now, I can Display several fields with :

clientContext.load(collListItem);

and

listItemInfo += '<strong>ID: </strong> '  + oListItem.get_id() +
'<strong>ID: </strong> '  + oListItem.get_item('field1') +
'<strong>ID: </strong> '  + oListItem.get_item('field2') +

But I also want to display the "Name" of the element, I can do it with :

clientContext.load(collListItem, 'Include(DisplayName)');

and

listItemInfo += '<strong>ID: </strong> '  + oListItem.get_displayName()

I didn't find yet how to combine these two Displays...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.