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:
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();
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 |
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 };
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 |
var oSettings = { object: oBusinessObject }; FeedDialogComponent.setSettings(oSettings);