1

I am trying to pick up the date for each item in a list but I cannot seem to figure out all to get the value.

I am using:

var startDate = listEnumerator.get_current().get_item('Start_x0020_Date')
1
  • Can you please add complete code to your question? Are you able to get other fields like Single line text/item ID? Commented Jul 25, 2019 at 4:40

1 Answer 1

0

In your success function, you can try something like below:

function Success() {
    var listEnumerator = collList.getEnumerator();

    while (listEnumerator.moveNext()) {
        var oList = listEnumerator.get_current();
        var startDate = oList.get_item('DateTimeColumnName');  // 'DateTimeColumnName' is internal name of date field
    }
}

You can find the complete code to get the list items using JSOM in below article:

How to: Retrieve Lists Using JavaScript.

How to find internal name of field:

  1. How to get Internal names of columns in sharepoint lists?
4
  • I have three different date fields on my list though, how would I differentiate between the three? Commented Jul 25, 2019 at 14:12
  • You must be having different internal names for each date and time field. So you can use that. check updated answer to find internal name Commented Jul 25, 2019 at 14:16
  • Is it not working? Try first saving current item in one variable and then fetching StartDate from that item as given in answer instead of writing in one line. Commented Jul 25, 2019 at 14:25
  • If it is working then please upvote(^) and accept as an answer so that it will help others to find the correct answer easily. Commented Jul 25, 2019 at 14:27

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.