I am testing using the Web API to update a currency field using a PUT request as per here. I am using the following sample code provided by Microsoft. This works fine when the field being updated is a string, however results in an 'Error:Common Data Service error occurred' for a currency field. I believe that this is because newValue is sent with quotes e.g. "999".
How can I amend the below code to allow for currency fields?
function updateRecordAttribute(col, recordObj) {
var attributeName = col.name,
value = recordObj[attributeName],
newValue = prompt("Please enter \"" + col.label + "\"", value);
if (newValue != null && newValue !== value) {
appAjax('Updating...', {
type: "PUT",
url: "/_api/contacts(" + recordObj.id + ")/" + attributeName,
contentType: "application/json",
data: JSON.stringify({
"value": newValue
}),
success: function (res) {
table.updateRecord(attributeName, newValue, recordObj);
}
});
}
return false;
}
Thanks in Advance