The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Date Picker in Service Portal

brian_
Mega Guru

I've found how to create your own reference field in Service Portal with <sn-record-picker>

<sn-record-picker field="location" table="'cmn_location'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>

http://serviceportal.io/sn-record-picker/

How do I make my own Date Picker field?

date.PNG

8 REPLIES 8

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

you could search and add your own bootstrap datepicker, such as:


Bootstrap 3 Datepicker



(below sample needs the glyhicons to be fixed, as it tries to get them from the CDN)




<script>https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker...."></script>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker..." />



<div>


  <div id="datetimepicker" class="input-append date">


      <input data-format="dd/MM/yyyy hh:mm:ss" type="text"></input>


      <span class="add-on">


          <i data-time-icon="icon-time" data-date-icon="icon-calendar">


          </i>


      </span>


  </div>


     


</div>



<script>


  $(function() {


      $('#datetimepicker').datetimepicker();


  });


</script>


brian_
Mega Guru

I was trying to avoid any 3rd party date pickers, as end-users could change their date format and I could only see this as causing problems down the road. I found there is an OOTB widget called "Form" that renders any table and view you point it to. I couldn't find the source of this, but I was able to use a copied/modified version of this widget to get my new record form working with Service Now date pickers!


Hi All,


Is there any OOTB date picker in service Portal like <sn-record-picker> ?


Because I am facing a problem with the HTML 5 date time field.



'<input type="datetime-local">'



When the value of that field is going to the server, it is deducting 5.30 hours. By the way, I have fixed the Issue. But in Service Portal, I am facing a major issue of TIMEZONE Conversion.


On Service Portal Time Zone picked based on user profile date format.



So you set the date format for users then it will work fine for service portal.



Regards,


Parvinder