- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2022 07:51 AM
Hello,
I have created a date picker in widget that will take input date from user. The date picked by the user updates a field in Approval table. But it is updating wrong date, it is updating one previous date like if I enter 24 it updates 23 in that field of Approval table. What am I missing?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2022 10:34 AM
Try this code
HTML
<sp-date-picker name="mydata" sn-include-time=false field="c.fromDate" ng-model="c.fromDate.value" ></sp-date-picker>
<button class="btn btn-primary" ng-click="UpdateData()">
${Save}
</button>
Client
api.controller=function($scope) {
/* widget controller */
var c=this;
c.fromDate = {
displayValue: '',
value: c.data.myInput,
name: ''
};
$scope.UpdateData = function(){
var input = {};
input.myInput = c.fromDate.value;
c.server.get(input);
}
}
Server
(function() {
if(input){
var inc1 = new GlideRecord('your_table');
inc1.get('recordSysID');
inc1.setValue('yourDateField', input.myInput);
inc1.update();
}
})();
Works for me when i tested
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 01:27 AM
Thankyou.
Its working fine. Can you tell me what I was missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 06:32 AM
The code from the other post didn’t work for me, so I wrote/found new code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 06:42 AM
oh greatttt.....thanku.