Pre-Requisite for SAP Cloud Platform Workflow with SAP Jam Sample Application
A sample workflow application is shipped as part of SAP Web IDE to help you experience collaboration in SAP Cloud Platform Workflow using SAP Jam.
This blog details the pre-requisites to complete before you can import the sample workflow application.
1. Get access to SAP Cloud Platform and Enable Workflow Service
- If you do not have an SAP Cloud Platform account or you have not enabled Workflow Service in it, then follow the blog and get started with SAP Cloud Platform Workflow for free.
- Assign WorkflowDeveloper, WorkflowAdmin, WorkflowInitiator, WorkflowParticipants roles to the developer, the administrator, the workflow initiator and workflow task recipients respectively. Refer to workflow help document on how to assign the roles.
Note: The SAP Cloud Platform trial account supports one user only and hence you would assign all the roles to a single user.
2. Enable SAP Jam Service
If you are using the free SAP Cloud Platform trial account, then follow the steps to enable SAP Jam service. If you have a factory account, then ask your administrator to enable the same.
- In the SAP Cloud Platform Cockpit of your trial account, select Services section.
- Under the Collaboration category, select the tile corresponding to SAP Jam.
- If the SAP Jam service is not enabled, then click the Enable button and the SAP Jam service should be successfully activated in a few seconds.
- Once the service is enabled, to access your SAP Jam account, click Go to Service link as shown in the image below.
- You should be taken to the SAP Jam home page. You can bookmark this URL for future access.
- To add more users to SAP Jam (maximum of 3 users in trial accounts), follow the steps mentioned in this blog (section Setting up new users). The additional users can be later added as contributors to the document.
3. Connect SAP Cloud Platform and SAP Jam
3.1 Setup Trust between SAP Cloud Platform and SAP Jam
- Follow the tutorial to set up trust between SAP Cloud Platform and SAP Jam: https://www.sap.com/developer/tutorials/jam-cloud-setup-trust.html
The purpose of the trust configuration is to support principal propagation – forwarding the logged on identity in the SAP Cloud Platform to SAP Jam. This means, logging on with a user that matches this identity without the need of providing the password (SSO).
Note: The principal propagation as explained in this document works when the SAP Jam and SAP Cloud Platform use the same identity provider (IDP). In the trial account, SAP ID Service is the default IDP. You can also use SAP Cloud Platform Identify Authentication Service (IAS) when using your factory SAP Jam account, but make sure that User ID is configured as the Name ID attribute for both SAP Jam and SAP Cloud Platform applications in SAP IAS. Refer to the blog from Christian Happel for more details on how to achieve this.
3.2 Create and Configure OAuth Client in SAP Jam
- In SAP Jam Admin page, choose Integration -> OAuth Clients.
- Click Add OAuth Client.
- Enter any value for Name (example, SAP Cloud Platform Trial).
- Enter https://trial/<youruserID>trial as Integration URL and click Save. (The integration URL can be any URL of your choice and doesn’t affect the outcome).
- Click Save.
- From the OAuth client list, click on View to view the newly created OAuth client.
- Copy the value of the field Key from the OAuth client page and keep it handy in a notepad application.
3.3 Create Destination in SAP Cloud Platform
- Create a text file named sap_jam_odata and paste the following into this file:
Type=HTTP TrustAll=true audience=cubetree.com Authentication=OAuth2SAMLBearerAssertion WebIDEUsage=odata_gen Name=sap_jam_odata WebIDEEnabled=true tokenServiceURL=https\://developer.sapjam.com/api/v1/auth/token ProxyType=Internet URL=https\://developer.sapjam.com
Note: The above configuration is to connect to your trial SAP Jam account. If you are using your own SAP Jam account, then use the corresponding URL (https://<jamtenant>.sapjam.com) & Token Service URL (https://<jamtenant>.sapjam.com/api/v1/auth/token).
- In your SAP Cloud Platform cockpit, navigate to Connectivity -> Destinations.
- Click Import Destination button.
- Select the destination configuration file sap_jam_odata and click Open.
- Paste the OAuth Key copied earlier into the Client Key filed.
- Save the destination.
Note: If you see a red warning ‘Client Key cannot be empty’ then change Authentication from Oauth2SAMLBearerAssertion to No Authentication and then change it back to Oauth2SAMLBearerAssertion
4. Identify SAP Jam Bootstrap & Feed Widget Endpoint URL
- In SAP Jam Admin page, choose Widget Builders under Integration section.
- In the Widget Builder page, scroll to the code preview section and copy the two URLs highlighted in the image below. This will be used later to configure the sample application.
- Copy the feedWidget URL (https://developer.sapjam.com/c/<yourUserID>trial.hanatrial.ondemand.com.cubetree.biz/widget/v1/feed) as jamAccountFeedEndpoint in a notepad application.
- Copy the host URL (https://developer.sapjam.com) as jamBaseURL in a notepad application.
Note: If you are using a factory SAP Jam account, then the URL will be different
5. Setup SAP Jam Group for uploading the documents
Follow this section only if you do not have a group created in your Jam Account.
- Log in to your SAP Jam account.
- Click Groups button as shown and in the My Groups page click Create a Group button as shown.
- In the Create Group pop-up, enter the group name as Document Approvals and click Create button.
- In the next page, click Accept button to confirm the creation of your Jam group.
- Follow the help document Invite to the Jam group the users who will be part of the approval process.
6. Create Folders where the Documents will be Uploaded
Follow this section only if you do not have a couple of folders available in your Jam group.
- In the SAP Jam group Document Approvals, click on the section Content as shown below:
- From the Content page, click Create button and choose New Folder.
- In the Add Folder pop-up, give the Folder Name as Documents for Approval and click Submit button. All documents will be uploaded into this folder.
- Similarly, add another folder with the name Approved Documents. Once the document has been approved by all the parties, the document will be moved to this folder.
7. Get the Group and Folder ID
To use the SAP Jam API to upload documents to specific folder and groups, we need to identify the SAP Jam group ID and the folder IDs.
- When in the Content page, observe the URL in the browser. The group ID is the set of characters which follows the keyword groups in the URL, as highlighted in red below. Copy this group ID and keep it handy in a notepad application as jamGroupID.
- From the Content page, click on the folder Documents for Approval to navigate into the folder.
- Observe the URL in the browser. The folder ID is the set of characters which follows the keyword ‘folder_id =’ in the URL, as highlighted in red below. Copy the folder ID and keep it handy in a notepad application as jamApprovalFolderID.
- Similarly, navigate into the Approved Documents folder and copy the folder ID and keep it handy in a notepad application as jamFinalFolderID.