Passing a date field in vlookup

Home Forums Classic DFFS Passing a date field in vlookup

Viewing 1 reply thread
  • Author
    Posts
    • #34268
      Keith Hudson
      Participant

        Alex, I’m trying to pass a DateTime field (date PLUS time) using vLookup. The date is passing just fine, but the time is not. Here are the details:

        1. I’m using vlookup on a custom list form to upload documents to a document library, so the dialog form that is opening is the edit form on the document library, since doc libraries do not have a new form.
        2. I have a Start Date field on my SharePoint list where the action is initiated. It contains date and time. I have added a similar Start Date field to the document library and made sure to set it to accept date AND time.
        3. In the vlookup settings, I am passing the value of Start Date field from the custom list to the Start Date field on the child document library.

        I have tried this using v 4.4.4.23 and v 4.4.5.27 of DFFS and it is not passing the time element of the Date Time field using either version of DFFS.

      • #34275
        Alexander Bautz
        Keymaster

          Hi,
          If I remember correctly vLookup only passes the date and not the time so you must use some custom js. Try adding this to your document library EditForm Custom JS:

          var vLookupParentList = GetUrlKeyValue("parentListGuid");
          if(vLookupParentList !== ""){
              var item = spjs.utility.getItemByID({
                  "listName": vLookupParentList,
                  "id": GetUrlKeyValue("parentItemId"),
                  "viewFields":["DateColumn_in_parent"]
              });
              if(item !== null && item.DateColumn_in_parent!== null){
                  spjs.utility.setDateFieldFromDateObject("DateColumn_in_child", new Date(item.DateColumn_in_parent.split("T").join(" ")));
              }
          }

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.