cancel
Showing results for 
Search instead for 
Did you mean: 

Secondary Model usage in Fiori extension - options?

MattHarding
Active Contributor
0 Kudos

Hi All,

I'm extending the My Inbox app, and rather than modify the RFC signature within the Task Gateway for each service to get back-end data; I've decided it is more elegant (and supportable) to create a new service (per backend) that can be used to extract additional data from a single work item (e.g. Purchase Order information) for a specific task/work item.

Whether this is right or wrong is a discussion for another post I'll do later; but my question is how to have both the original service model (/IWPGW/TASKPROCESSING) and my new task set-up in the extension project via WebIDE.

Currently, I have it working if I add the mock utility and load the model manually in the init of the component file:

this._startMockServer(sServiceUrl);
this._initODataModel(sServiceUrl, "MyCustomService");

But I'd prefer to use the existing framework that WebIDE supports which involves .project.json set-up, the manifest.json and an unavailable configuration.js file in my extension project.

I did note that the mockpreview tag in .project.json does support being an array (while the WebIDE project settings screen does not) but there is some funky configuration in the configuration.js that I'm unclear how to extend (possibly I just need to work out how to extend configuration.js to solve this).

oServiceParams: {

        serviceList: [

            {

                name: "TASKPROCESSING",

                masterCollection: "TaskCollection",

                serviceUrl: cross.fnd.fiori.inbox.Component.getMetadata().getManifestEntry("sap.app").dataSources["TASKPROCESSING"].uri,

                isDefault: true,

Anyone able to help do this more generically, rather than my old school solution?

Cheers,

Matt

ps. Complex problem to describe but appreciate if you understand what I'm trying to do and have some ideas.

Accepted Solutions (1)

Accepted Solutions (1)

MattHarding
Active Contributor
0 Kudos

Hi All,

Just a further update...I realised when I looked closer that selecting the mock data flag in WebIDE runtime configuration, it actually generates mock server start code inside your html file for the service defined in project.json file. Hence, copying the file, and turning off this flag is one way to get both services working in WebIDE; though obviously won't work if you use the extension pane with mock data.

Anyway, a step closer to understanding a better way.

Cheers,

Matt

Former Member
0 Kudos

Hi Matt,

The Web IDE doesn't support multiple OData services when using the Run with Mock Data feature. I would suggest to copy the content of the generated mock server start code into a new index.html file, and run it without the Run with Mock Data configuration. This way you will have full control on the mock server and can add as many mock server instances as you'd like to support mocking of multiple services.

In addition, if your index.html file contains the mock server start code of one service while the second service configured in the project.json file then extension pane with mock data should work.

Hope that helps,

Regards,

Gal

MattHarding
Active Contributor
0 Kudos

Thanks Gal - Worked a treat, though as discussed separately, I needed to replace the webide object that WebIDE attempts to use in the generated code if you also use a request specific mock javascript file.

Cheers,

Matt

Answers (0)