Prefill date and time

Forums vLooup for SharePoint Prefill date and time

Viewing 3 reply threads
  • 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

    • #25163
      Eddie Pryce
      Participant

      Hi

      I have just place this in my parent and child custom JS but it is not working, do i need to call it with a rule on the parent or child?

      Thanks in advance

    • #25165
      Eddie Pryce
      Participant

      Scratch that i got it working, had a typo in my code

Viewing 3 reply threads
  • You must be logged in to reply to this topic.