Hi,

I am trying to override a few methods in the MobileFileService class on Mobile as I need to replace the default logic of using the "FileService/GetFile" with a custom fetch logic from Sharepoint as we are using it as our document repository.

I have tried the below steps.

1) Created a new class and overrode the existing logic with the custom logic for Sharepoint.

Ext.define("Terrasoft.configuration.MobileFileServiceOverride", {
	override: "Terrasoft.FileService",
	alternateClassName: "Terrasoft.MobileFileServiceO",
	singleton: true,
	/*
	* @override
	*/
	getDownloadServiceUrl: function(config, schemaUId) {
		var serviceUrl = Terrasoft.ServiceHelper.getServiceUrl("FileService", "GetFile");
		var serviceUrlSP = "rest/SharepointService/File";
		var schemaName = config.fileRecord.self.modelName;
		if(schemaName === "CUSTOM"){
			return Ext.String.format("{0}/{1}/{2}", serviceUrl, schemaUId, config.fileRecord.getId());
		}
		else {
			return Ext.String.format("{0}/{1}/{2}", serviceUrlSP, config.fileRecord.getId(), schemaName);
		}
	}
});

  2) In the manifest file, I included the new class in the "CustomSchemas" attribute.

{
 
	"CustomSchemas": [
        "UsrMobileFileServiceOverride"
    ],
 
	"SyncOptions": {
		"SysSettingsImportConfig": [
			"DefaultMessageLanguage",
			"PrimaryCurrency"
		],
 
...
...
...
}

While debugging this using the emulator, I see that the method is not getting overridden. It still calls the older method. Am I missing a step here? Any help is deeply appreciated.

Thanks in advance...

Like 0

Like

1 comments

Hi,

This is resolved now. I actually missed another step. We also need to include the new class "UsrMobileFileServiceOverride" as a page extension for the object like opportunity, customer, etc in the manifest file under Models -> Opportunity/Customer -> PageExtensions.

Show all comments