Service portal widget - Date Picker directive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 11:56 AM
Hi guys,
I have this widget were I'm displaying the data (cmdb_ci_appl) based on how many records the user have his/her name against on the owned_by. I have "Default date" and "Effect date" date fields. The "Effect date" is populated with value of "Dafault date" by default - I have set this on my server script. However, end user should be able to change that value (of Effect date), and I want to be able to capture this new input from the user, pass it to the client script and then to the server script. Unfortunately, i get no value when i check console. Any advice would be much appreciated, thanks.
<|---My html code ---|>
<td>
<sp-date-picker ng-model="row.date" field="row.dateField" sn-change="" sn-include-time="false" placeholder="Optional"></sp-date-picker>
</td>
<|---My Client Script code ---|>
$scope.dateField = {
displayValue:'',
value: c.data.effectiveDate,
name:''
}
$scope.updateRecords = function(index, data) {
data.effectiveDate = $scope.dateField.value
c.ciRecords[index] = data;
c.data.ciRecords = c.ciRecords;
c.server.update().then(function(data) {
})
}
<|---My Server Script code ---|> where i define the model for date-picker
var getExpDate = grBusinessAppl.owned_by.u_ad_accountexpires;
var gdt = new GlideDateTime(getExpDate);
var gd = gdt.getDate();
dateField: {},
date: gd.getDisplayValue(),