Prefill date and time

Forums vLooup for SharePoint Prefill date and time

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 2 weeks, 2 days ago.

  • Author
    Posts
  • #24017

    Peter Giesselink
    Participant

    I cannot prefill the time of a datefield. I’m using a formatspecifier [dd-MM-yyyy HH:mm] behind the To variable and only the date is prefilled correctly and the time is 00:00. Know issue? or do I something wrong?

  • #24038

    Alexander Bautz
    Keymaster

    Hi,
    Unfortunately the default functionality does not support setting the time portion of the Date and time field, but you can set the date and time by adding this to your Custom JS in the PARENT form:

    function vlookupAddChildPreCheck(fin){
      sessionStorage.setItem("vLookupDateVariable",JSON.stringify(getFieldValue("Date").split(/ |:/)));
      return true;
    }

    Change Date to match your date field internal name.

    Then add this to the Custom JS of your CHILD form:

    if(sessionStorage.getItem("vLookupDateVariable") !== null){
      setFieldValue("Date",JSON.parse(sessionStorage.getItem("vLookupDateVariable")));
    }

    Change Date to match your date field internal name.

    Alexander

You must be logged in to reply to this topic.