Hi everyone,
I am trying to get the newly created entity in the backend as a result, but I cannot find anything in the documentation. Does anyone know if this is possible or not implemented at all. The OData service responds with the newly created entity.
This is the method in question: https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/Latest/en-US/Documents/Frameworks/SAPOData/Classes/OnlineODataProvider.html#/s:8SAPOData19OnlineODataProviderC12createEntityyAA0F5ValueC_AA11HTTPHeadersC7headersAA14RequestOptionsC7optionstKF
And a code sample would look something like this:
@objc func createEntity() {
self.showFioriLoadingIndicator()
self.view.endEditing(true)
self.logger.info("Creating entity in backend.")
self.zfsmobilesrvEntities.createEntity(self.entity) { error in
self.hideFioriLoadingIndicator()
if let error = error {
self.logger.error("Create entry failed. Error: \(error)", error: error)
let alertController = UIAlertController(title: NSLocalizedString("keyErrorEntityCreationTitle", value: "Create entry failed", comment: "XTIT: Title of alert message about entity creation error."), message: error.localizedDescription, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: self.okTitle, style: .default))
OperationQueue.main.addOperation({
// Present the alertController
self.present(alertController, animated: true)
})
return
}
self.logger.info("Create entry finished successfully.")
OperationQueue.main.addOperation({
self.dismiss(animated: true) {
FUIToastMessage.show(message: NSLocalizedString("keyEntityCreationBody", value: "Created", comment: "XMSG: Title of alert message about successful entity creation."))
self.tableUpdater?.entitySetHasChanged()
}
})
}
}
Basically, in the line of a successful creation of an entry, I would like to know if there is a way to also get the new entity as an object.
Thank you in advance!