Show TOC

Full Code Sample: Discuss DialogLocate this document in the navigation structure

This sample code demonstrates the integration of the Discuss Dialog component in the Detail view of a custom SAP Fiori app. You can use this code as a template and modify it to suit your business needs.

The figure below shows the Master and Detail views of an SAP Fiori app.

In this example, the second tab of the Detail view includes two buttons related to the Discuss Dialog component:

  • open discuss

    This button opens the Discuss dialog.

  • set settings

    This button changes the settings sent to the Discuss Dialog component.

Detail View:

View Controller:

Selectable Code

The full code sample described above is available in a selectable format:

Detail View:

< core:View      
          controllerName ="collaboration-demo.view.detail_3"      
          xmlns ="sap.m"      
          xmlns:me ="sap.me"      
          xmlns:core ="sap.ui.core"      
          xmlns:form ="sap.ui.layout.form"      
          xmlns:mvc ="sap.ui.core.mvc">         

          < Pageid ="detailPage"class ="sapUiFioriObjectPage"showNavButton ="false">
               < content >
                            < ObjectHeaderid ="Header"
                                           introActive ="false"
                                           title ="SO 3212"
                                           titleActive ="true"
                                           number ="1000"
                                           numberUnit ="USD">
                            < firstStatus >
                                   < ObjectStatustext ="opened" state ="Warning"></ ObjectStatus >
                            </ firstStatus >
                      </ ObjectHeader >

                      < IconTabBarid ="SO03_ICONTABBAR"select ="onTabFilterSelect"expanded ="true"expandable ="false">
                            < items >
                                   < IconTabFilterkey ="hint"icon ="sap-icon://hint">
                                        < content >
                                        < form:SimpleFormmaxContainerCols ="1">
                                                 < form:content >                                                      
                                                                     
                                                      <!-- Customer section -->                                                             
                                                      < core:Titleid ="SO03_TI_CUSTOMER"text ="{i18n>Customer}"/>                                                             
                                                                     
                                                      < Labelid ="SO03_LBL_SOLDTOPARTY"text ="{i18n>SoldtoParty}"/>                                                             
                                                      < Linkid ="SO03_LNK_SOLDTOPARTY"text ="sap.com"href ="http://sap.com"/>                                                             
                                                                     
                                                      < Labelid ="SO03_LBL_RISKCATEGOTY"text ="{i18n>RiskCategory}"/>                                                             
                                                      < Textid ="SO03_TXT_RISKCATEGOTY"text ="low"/>                                                      
                                                </ form:content >                                               
                                       </ form:SimpleForm >                                                         
                                    </ content >
                                   </ IconTabFilter >
                                   < IconTabFilterkey ="att"icon ="sap-icon://share">                                        
                                        < content >                                               
                                             < Buttonid ="discussButton"text ="open discuss"press ="onDiscussButtonPress"/>                                               
                                             < Buttonid ="setSettingsButton"text ="set settings"press ="onSetSettingsPress"/>                                        
                                        </ content >
                                   </ IconTabFilter >
                            </ items >
                      </ IconTabBar >
                 </ content >
             </ Page >
</ core:View > 

View Controller:

jQuery.sap.declare("collaboration-demo.view.detail.controller");
jQuery.sap.require("sap.ca.scfld.md.controller.BaseDetailController");

sap.ca.scfld.md.controller.BaseDetailController.extend("collaboration-demo.view.detail", {
       
       onInit: function() {
              sap.ca.scfld.md.controller.BaseDetailController.prototype.onInit.call(this);
              
              this.initializeDiscussComponent();
       },
       
       onAfterRendering: function() {
       },
       
       initializeDiscussComponent : function() {
              var oBusinessObject = {
                            id:"/sap/opu/odata/CRMSWI01/CRMSMI_SRV/OpportunityCollection(ObjectID='4D4B224D89DD4E36E10000000A42823A',ObjectType='BUS2000111')",
                                  type: "/sap/opu/odata/CRMSWI01/CRMSMI_SRV/$metadata#OpportunityCollection",
                                  name: "SO 3212",
                                  ui_url: window.location.href
                           };

              this.oDiscussComponent = sap.ui.getCore().createComponent({
                    name: "sap.collaboration.components.fiori.feed.dialog",
                    id: "feedDialogComponent",
                    settings: {   
                                         object: oBusinessObject
                    }
             });

       },
       
       onDiscussButtonPress : function() {
              this.oDiscussComponent.open();
       },
       
       onSetSettingsPress : function() {
              var oBusinessObject = {
                            id:"/sap/opu/odata/CRMSWI01/CRMSMI_SRV/OpportunityCollection(ObjectID='3E4B224D89DD4E36E10000000A42823NB',ObjectType='BUS2000111')",
                                  type: "/sap/opu/odata/CRMSWI01/CRMSMI_SRV/$metadata#OpportunityCollection",
                                  name: "SO 3213",
                                  ui_url: window.location.href
                           };
              
              var oSettings = {
                           object : oBusinessObject
              };
              
              this.oDiscussComponent.setSettings(oSettings);
       }

       
});