I'm trying to make a request from sugar portal from a custom field controller to retrieve a record of Od_One_Drive module but it throws me an status 404, I check it out and it does exist, I change permissions of this module but it's the same, do I have to do something else? It would be great if someone knows what could it be happening or knows something that it might help me.
this is my code
({ tempDownloadUrl: null, initialize: async function (options) { this._super('initialize', [options]); this.model.on('data:sync:complete', _.bind(this._prepareOneDriveLink, this)); }, _prepareOneDriveLink: async function () { let fileId; debugger; if (this.tempDownloadUrl != null) { return; } try { const oneDriveRecord = await this._getOneDriveRecord(); fileId = oneDriveRecord.onedrivefileid_c; } catch (error) { console.log(error); } const errorOneDrive = this.model.get('one_drive_errors_c'); if (errorOneDrive !== "") { this.showOneDriveError(); return; } if (!fileId) { this.tempDownloadUrl = false; this.showFileNotUploadedAlert(); return; } try { const response = await app.utils.esbClient.getFileLink(fileId); this.tempDownloadUrl = response.data.dataItem.webUrl; this._render(); } catch (error) { if (error.status == 404) { this.showFileNotFoundAlert(); } } }, _getOneDriveRecord: function() { let self = this; return new Promise((resolve, reject) => { if (!self.model.get('od_one_drive_id_c')) { return reject('od_one_drive_id_c is not set'); } console.log(self.model.get('od_one_drive_id_c')); app.api.call('read', app.api.buildURL(`Od_One_Drive/${self.model.get('od_one_drive_id_c')}`), null, { error: () => { reject('FAILED'); }, success: function (oneDriveRecord) { resolve({ meessage: 'SUCCESS', data: oneDriveRecord }); }, }) }); }, showFileNotUploadedAlert: function() { if (app.controller.context.attributes.layout != 'record') { return; } app.alert.show('file_not_uploaded', { level: 'warning', messages: 'El archivo aun no ha terminado de subirse a One Drive' }); }, showOneDriveError: function() { app.alert.show('error_one_drive', { level: 'error', messages: 'El archivo no se pudo subir a One Drive, vuelve a intentarlo' }); }, showFileNotFoundAlert: function () { app.alert.show('file_not_uploaded', { level: 'error', messages: 'El archivo no se ha encontrado en OneDrive' }); } })
and here is how I left permissions