Hi,
I get an error when trying to run the js code below. The idea is to create a new record and populate 3 fields on create. It seems to run fine when i remove the lookup field, but when adding that, then I get the following error:
An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.
This is the code i try to run:
function createContractFlowRecord(contractType) {
//Get Account GUID
var accountid = Xrm.Page.data.entity.getId();
//Get field "name" from Account entity
var accountName = Xrm.Page.getAttribute("name").getValue();
console.log(accountName);
console.log(accountid);
var entityLogicalName = "linak_contractflow";
var data = {
"linak_Account@odata.bind": "/Account(0e924ec4-3a3c-ea11-a812-000d3a4aa4e2)",
"linak_Contracttype": contractType,
"linak_name": "Test vit"
};
// create contract flow record
Xrm.WebApi.createRecord("linak_contractflow", data).then(
function success(result) {
console.log("Contract flow record created with ID: " + result.id);
// perform operations on record creation
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
}
Can you see what I should be doing differently? I am testing it against D365 CE 9.1.0000.15051
BR, Vivian