- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 01:05 PM
Is there a way to convert the html type 'date' to Servicenow type 'date' ?
Screenshots for reference -
HTML type -> date :
Servicenow type --> date :
I'm not able to copy the 'date' from the registration form to the table. Registration form is on the portal.
Any suggestions? Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2019 06:46 AM
I got what you need. You need some form of handler to display the date when it changes. By default, it displayed (for me) before the date was changed. Client script code that is not in a function gets run on load time. Here is my HTML and Client script as an example. I suspect your main issue was that the field and ng-model attributes didn't match.
<div class="col-sm-6">
<div class="form-group">
<label for="date">Inspection Date</label><span id="p3" class="req"></span>
<sp-date-picker field="data.date" ng-model="data.date" Placeholder="Inspection date" sn-change="dateChanged()"></sp-date-picker>
</div>
</div>
Client script
function($scope) {
/* widget controller */
var c = this;
$scope.dateChanged = function() {
console.log('date=' + c.data.date);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2019 06:46 AM
I got what you need. You need some form of handler to display the date when it changes. By default, it displayed (for me) before the date was changed. Client script code that is not in a function gets run on load time. Here is my HTML and Client script as an example. I suspect your main issue was that the field and ng-model attributes didn't match.
<div class="col-sm-6">
<div class="form-group">
<label for="date">Inspection Date</label><span id="p3" class="req"></span>
<sp-date-picker field="data.date" ng-model="data.date" Placeholder="Inspection date" sn-change="dateChanged()"></sp-date-picker>
</div>
</div>
Client script
function($scope) {
/* widget controller */
var c = this;
$scope.dateChanged = function() {
console.log('date=' + c.data.date);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2019 07:38 AM
I found something similar here -
I'm getting this error every time I run the script :

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2019 02:48 PM
Double check the values in field and ng-model. They need to match. For your use case, it needs to be data.date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019 07:03 AM