Is there a better approach to retrieving variables from a GET OData call? I'm struggling with extracting the 'id' variable from the call within my method. I've tried using callbacks, but have not been successful. Do you have any suggestions for this issue? I also attempted placing the call in a separate function, but then encountered the problem of the return variable being undefined and inaccessible.
Update / additional:
In a method where I am performing OData updates and inserts, I am retrieving an 'id'. This 'id' is needed as a parameter for another OData update in the next step. The challenge I'm facing is the inability to work with the 'id' variable in subsequent steps of my code, as it is only accessible within the oModel {} section.
oModel.read("/ZDEMA_LENDINGS2Set", {
urlParameters: {
"$select": "Id",
"$top": 1
},
success: function(oData, oResponse) {
console.log("Data", oData);
console.log("Response", oResponse);
var id = oData.results[0].Id;
},
error: function(oError) {
console.log("Error", oError);
}
}