Show TOC

Integrating the Discuss Dialog ComponentLocate this document in the navigation structure

This section provides sample code and explanations that help you to directly integrate the Discuss Dialog component into your custom SAP Fiori app.

The Discuss Dialog component is a dialog that contains the following, as shown in the figure below:

  • Text box in which users enter discussion text
  • SAP Jam feed related to the business object being discussed (if applicable)
  • Close button

Integration Code

The sample code below demonstrates how you can create the Discuss Dialog component using the sap.ui.getCore().createComponent() function, which is available in the SAPUI5 library.

var oDiscussComponent = sap.ui.getCore().createComponent({
		 		name: "sap.collaboration.components.fiori.feed.dialog",
		 		id: "feedDialogComponent",
		 		settings: {	
            					object: oBusinessObject
		 		}
		 	});
oDiscussComponent.open();
Create Component Function Properties

The sap.ui.getCore().createComponent() function requires a JSON object that has the following properties:

Property Description
name Namespace for the Discuss Dialog component (sap.collaboration.components.fiori.feed.dialog)
id (optional) Unique ID that you give to the Discuss Dialog component. If not provided, the framework creates an ID.
settings JSON object that contains the following property:

object: JSON object that represents the business object you want to discuss

Business Object Code

The sample code below shows the business object representation (oBusinessObject in the code example above).

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
};
Business Object Properties

The oBusinessObject can have the following properties:

id Business object ID. This ID must be an OData URL containing the relative path to the object in the back-end system.
Example /sap/opu/odata/CRMSWI01/CRMSMI_SRV/OpportunityCollection(ObjectID='4D4B224D89DD4E36E10000000A42823A',ObjectType='BUS2000111')
type Type of the business object. It must be the OData metadata URL to the object collection.
Example /sap/opu/odata/CRMSWI01/CRMSMI_SRV/$metadata#OpportunityCollection
name (optional) Description of the business object to be displayed in SAP Jam
Example SO 4711, Opportunity 4711, and so on
ui_url (optional) URL to navigate back to the same business object in your SAP Fiori application
Note
  • Together, the id and type properties uniquely identify the business object in SAP Jam.
  • You also need to set up corresponding external applications and business objects in SAP Jam. For more information, see Back-End Configuration and Configuring SAP Jam.
Further Recommendations
  • Assign a meaningful name for the optional name attribute, as the system uses the id attribute, which is typically not human-readable, to display the object in the feed entries when the name attribute is not available.
  • Provide the ui_url attribute. With the ui_url attribute, we create a clickable hyperlink for the object name displayed in the feed entries. This hyperlink navigates back to the same object in your application (if you provide it with the URL to the object in your application).
  • Only create the Discuss Dialog component once (the first time it is needed). Subsequently, use the setSettings function within your code if you need to display different business objects, as shown below:
    var oSettings = {
    			object: oBusinessObject				
    };
    							 								 	
    FeedDialogComponent.setSettings(oSettings);