
Announcements
Hi,
I am having a problem updating a Date and Time column in my Dataverse table.
var n = Date.now();
var timestamp = n.toString();
webapi.safeAjax({
type: "PUT",
url: "/_api/TABLE(cdffea91-90ac-ed11-aad1-002248322cfa)/TIMESTAMP_FIELD",
contentType: "application/json",
data: JSON.stringify({
"value": timestamp
}),
success: function (res) {
console.log(res);
}
});
I get
Question is - how do you update a Date and Time column.
Thanks
In order to update date time column through Web API you must follow steps that is mentioned in below blog
OR
You can also refer below code in which it will update the current record with current date and time using Web API from Portal
<script>
$(document).ready(function () {
const datetime = Date.now();
webapi.safeAjax({
type: "PATCH",
url: "/_api/accounts(2130d4ff-b0b1-ec11-9840-0022481e23b4)",
contentType: "application/json",
data: JSON.stringify({
"new_accountrenewed":new Date()
}),
success: function (res, status, xhr) {
var accountid = xhr.getResponseHeader("entityid");
alert("Updated record :" +accountid);
}
});
});
</script>
NOTE: Please don’t forget to add site settings and table permissions.
Hope this helps!!!
If you find this solution helpful, please mark it as the accepted solution.
Thanks!
Inogic Professional Services
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email at crm@inogic.com
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/