Example
var execute_new_TestDate_Request = {
// Parameters
InputDate: new Date("2025-03-01 11:16").toISOString(), // Edm.DateTimeOffset
getMetadata: function () {
return {
boundParameter: null,
parameterTypes: {
InputDate: { typeName: "Edm.DateTimeOffset", structuralProperty: 1 }
},
operationType: 0, operationName: "new_TestDate"
};
}
};
The Xrm.WebApi syntax is not doing a JSON.stringify of the parameters (with other syntaxes like Fetch the body is created using JSON.stringify) and for DateTime parameters the generated string causes an error.
Temporary fix is to stringify the DateTime parameter, example:
InputDate: JSON.stringify(new Date("2025-03-01 11:16").toISOString()), // Edm.DateTimeOffset
or to add quotes around the value:
InputDate: "'" + new Date("2025-03-01 11:16").toISOString() + "'", // Edm.DateTimeOffset