I'm having an interesting issue with AJAX Data Services. I am unable to update a foreign key reference. I am able to update scalar values and I am also able to insert a new row with a foreign key reference, but I can't edit one. Here is a code snippet of inserting, which does work:
The packageResult and packageTypeResult objects are objects that I've just looked up. I've confirmed that those have been populated and are working.
var newPackage =
{
PackageID: packageResult.PackageID,
PackageName: packageResult.PackageName,
PackagePriority: packageResult.PackagePriority,
PackageType: { __metadata: { uri: "/PackageType(" + packageTypeResult.PackageTypeID + ")"} }
};
proxy.insert(newPackage, "Package", OnSuccess, OnFailure, userContext);
However, the following does not work:
var updatedPackage =
{
Go to the complete details ...