├── .gitignore ├── .reuse └── dep5 ├── LICENSES └── Apache-2.0.txt ├── README.md ├── exercises ├── 10 │ ├── addscripttask.png │ ├── commentsincontext.png │ ├── readme.md │ └── usertaskinfo.png ├── 01 │ ├── appstudio.png │ ├── bas-subscribe.png │ ├── boostertile.png │ ├── bpmservice-rolecollection.png │ ├── collectionassigned.png │ ├── destinations.png │ ├── devspaceavailable.png │ ├── devspaces.png │ ├── newdevspace.png │ ├── readme.md │ ├── rolecollection.png │ ├── rolecollectionassignment.png │ ├── serviceinstances.png │ ├── servicemarketplace.png │ ├── spacedetail.png │ ├── subaccountoverview.png │ ├── subaccounts.png │ ├── targetmessage.png │ ├── trustconfigoverview.png │ ├── trustconfiguration.png │ └── workflowoverview.png ├── 02 │ ├── BPMServicesFLP.zip │ ├── applicationoverview.png │ ├── bpmserviceflpproject.png │ ├── bpmservicesflpzip.png │ ├── buildmtacommand.png │ ├── deploymtaarchivecommand.png │ ├── devspacedetail.png │ ├── flpsite.png │ ├── openworkspace.png │ ├── readme.md │ ├── servicebindings.png │ ├── serviceinstancelist.png │ └── spaceoverview.png ├── 03 │ ├── Dockerfile │ ├── accesssummary.png │ ├── connectionestablished.png │ ├── connectionstatus.png │ ├── jvmdownload.png │ ├── mappingsummary.png │ ├── reachablevalidation.png │ ├── readme.md │ ├── sccdownload.png │ ├── subaccountdetails.png │ └── subaccountid.png ├── 04 │ ├── appentry.png │ ├── approuteurl.png │ ├── dest-test-app │ │ ├── app.zip │ │ ├── manifest.yml │ │ ├── package.json │ │ ├── prep.bash │ │ ├── xs-app.json │ │ └── xs-security.json │ ├── neo-app.json │ ├── readme.md │ ├── servicedocument.png │ └── serviceinstances.png ├── 05 │ ├── deploy.png │ ├── readme.md │ ├── simpleworkflowdefinition.png │ ├── workflowdefinitionv1.png │ └── yomenu.png ├── 06 │ ├── environmentconfiguration.png │ ├── envselected.png │ ├── errorresponse.png │ ├── get-workflow-definitions.png │ ├── instancedetails.png │ ├── post-workflow-instances.png │ ├── readme.md │ ├── servicekey.png │ └── workflowapisummary.png ├── 07 │ ├── accesstoken.png │ ├── csrftokenreturned.png │ ├── envdetails.png │ ├── envvarvals.png │ ├── import-collection.png │ ├── instancecreated.png │ ├── oauthtype.png │ ├── readme.md │ ├── requesttoken.png │ ├── varinrequest.png │ ├── workflowapivalue.png │ └── workflowcollection.json ├── 08 │ ├── readme.md │ ├── servicetaskadded.png │ └── servicetaskselection.png ├── 09 │ ├── arrangementbuttons.png │ ├── formdecisions.png │ ├── formfields.png │ ├── myinboxitem.png │ ├── newformdialog.png │ ├── readme.md │ ├── runninginstance.png │ ├── taskinmyinbox.png │ ├── uidetails.png │ └── usertaskform.png └── template.md ├── prerequisites.md └── utils ├── delete-destination.bash └── reset.bash /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | key.json 3 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: cloud-platform-workflow-virtual-event 3 | Upstream-Contact: DJ Adams 4 | Source: https://github.com/SAP-samples/cloud-platform-workflow-virtual-event 5 | Disclaimer: The code in this project may include calls to APIs (“API Calls”) of 6 | SAP or third-party products or services developed outside of this project 7 | (“External Products”). 8 | “APIs” means application programming interfaces, as well as their respective 9 | specifications and implementing code that allows software to communicate with 10 | other software. 11 | API Calls to External Products are not licensed under the open source license 12 | that governs this project. The use of such API Calls and related External 13 | Products are subject to applicable additional agreements with the relevant 14 | provider of the External Products. In no event shall the open source license 15 | that governs this project grant any rights in or to any External Products,or 16 | alter, expand or supersede any terms of the applicable additional agreements. 17 | If you have a valid license agreement with SAP for the use of a particular SAP 18 | External Product, then you may make use of any API Calls included in this 19 | project’s code for that SAP External Product, subject to the terms of such 20 | license agreement. If you do not have a valid license agreement for the use of 21 | a particular SAP External Product, then you may only make use of any API Calls 22 | in this project for that SAP External Product for your internal, non-productive 23 | and non-commercial test and evaluation of such API Calls. Nothing herein grants 24 | you any rights to use or access any SAP External Product, or provide any third 25 | parties the right to use of access any SAP External Product, through API Calls. 26 | 27 | Files: * 28 | Copyright: 2020 SAP SE or an SAP affiliate company and cloud-platform-workflow-virtual-event contributors 29 | License: Apache-2.0 30 | -------------------------------------------------------------------------------- /LICENSES/Apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, 6 | AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | 11 | 12 | "License" shall mean the terms and conditions for use, reproduction, and distribution 13 | as defined by Sections 1 through 9 of this document. 14 | 15 | 16 | 17 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 18 | owner that is granting the License. 19 | 20 | 21 | 22 | "Legal Entity" shall mean the union of the acting entity and all other entities 23 | that control, are controlled by, or are under common control with that entity. 24 | For the purposes of this definition, "control" means (i) the power, direct 25 | or indirect, to cause the direction or management of such entity, whether 26 | by contract or otherwise, or (ii) ownership of fifty percent (50%) or more 27 | of the outstanding shares, or (iii) beneficial ownership of such entity. 28 | 29 | 30 | 31 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions 32 | granted by this License. 33 | 34 | 35 | 36 | "Source" form shall mean the preferred form for making modifications, including 37 | but not limited to software source code, documentation source, and configuration 38 | files. 39 | 40 | 41 | 42 | "Object" form shall mean any form resulting from mechanical transformation 43 | or translation of a Source form, including but not limited to compiled object 44 | code, generated documentation, and conversions to other media types. 45 | 46 | 47 | 48 | "Work" shall mean the work of authorship, whether in Source or Object form, 49 | made available under the License, as indicated by a copyright notice that 50 | is included in or attached to the work (an example is provided in the Appendix 51 | below). 52 | 53 | 54 | 55 | "Derivative Works" shall mean any work, whether in Source or Object form, 56 | that is based on (or derived from) the Work and for which the editorial revisions, 57 | annotations, elaborations, or other modifications represent, as a whole, an 58 | original work of authorship. For the purposes of this License, Derivative 59 | Works shall not include works that remain separable from, or merely link (or 60 | bind by name) to the interfaces of, the Work and Derivative Works thereof. 61 | 62 | 63 | 64 | "Contribution" shall mean any work of authorship, including the original version 65 | of the Work and any modifications or additions to that Work or Derivative 66 | Works thereof, that is intentionally submitted to Licensor for inclusion in 67 | the Work by the copyright owner or by an individual or Legal Entity authorized 68 | to submit on behalf of the copyright owner. For the purposes of this definition, 69 | "submitted" means any form of electronic, verbal, or written communication 70 | sent to the Licensor or its representatives, including but not limited to 71 | communication on electronic mailing lists, source code control systems, and 72 | issue tracking systems that are managed by, or on behalf of, the Licensor 73 | for the purpose of discussing and improving the Work, but excluding communication 74 | that is conspicuously marked or otherwise designated in writing by the copyright 75 | owner as "Not a Contribution." 76 | 77 | 78 | 79 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 80 | of whom a Contribution has been received by Licensor and subsequently incorporated 81 | within the Work. 82 | 83 | 2. Grant of Copyright License. Subject to the terms and conditions of this 84 | License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 85 | no-charge, royalty-free, irrevocable copyright license to reproduce, prepare 86 | Derivative Works of, publicly display, publicly perform, sublicense, and distribute 87 | the Work and such Derivative Works in Source or Object form. 88 | 89 | 3. Grant of Patent License. Subject to the terms and conditions of this License, 90 | each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 91 | no-charge, royalty-free, irrevocable (except as stated in this section) patent 92 | license to make, have made, use, offer to sell, sell, import, and otherwise 93 | transfer the Work, where such license applies only to those patent claims 94 | licensable by such Contributor that are necessarily infringed by their Contribution(s) 95 | alone or by combination of their Contribution(s) with the Work to which such 96 | Contribution(s) was submitted. If You institute patent litigation against 97 | any entity (including a cross-claim or counterclaim in a lawsuit) alleging 98 | that the Work or a Contribution incorporated within the Work constitutes direct 99 | or contributory patent infringement, then any patent licenses granted to You 100 | under this License for that Work shall terminate as of the date such litigation 101 | is filed. 102 | 103 | 4. Redistribution. You may reproduce and distribute copies of the Work or 104 | Derivative Works thereof in any medium, with or without modifications, and 105 | in Source or Object form, provided that You meet the following conditions: 106 | 107 | (a) You must give any other recipients of the Work or Derivative Works a copy 108 | of this License; and 109 | 110 | (b) You must cause any modified files to carry prominent notices stating that 111 | You changed the files; and 112 | 113 | (c) You must retain, in the Source form of any Derivative Works that You distribute, 114 | all copyright, patent, trademark, and attribution notices from the Source 115 | form of the Work, excluding those notices that do not pertain to any part 116 | of the Derivative Works; and 117 | 118 | (d) If the Work includes a "NOTICE" text file as part of its distribution, 119 | then any Derivative Works that You distribute must include a readable copy 120 | of the attribution notices contained within such NOTICE file, excluding those 121 | notices that do not pertain to any part of the Derivative Works, in at least 122 | one of the following places: within a NOTICE text file distributed as part 123 | of the Derivative Works; within the Source form or documentation, if provided 124 | along with the Derivative Works; or, within a display generated by the Derivative 125 | Works, if and wherever such third-party notices normally appear. The contents 126 | of the NOTICE file are for informational purposes only and do not modify the 127 | License. You may add Your own attribution notices within Derivative Works 128 | that You distribute, alongside or as an addendum to the NOTICE text from the 129 | Work, provided that such additional attribution notices cannot be construed 130 | as modifying the License. 131 | 132 | You may add Your own copyright statement to Your modifications and may provide 133 | additional or different license terms and conditions for use, reproduction, 134 | or distribution of Your modifications, or for any such Derivative Works as 135 | a whole, provided Your use, reproduction, and distribution of the Work otherwise 136 | complies with the conditions stated in this License. 137 | 138 | 5. Submission of Contributions. Unless You explicitly state otherwise, any 139 | Contribution intentionally submitted for inclusion in the Work by You to the 140 | Licensor shall be under the terms and conditions of this License, without 141 | any additional terms or conditions. Notwithstanding the above, nothing herein 142 | shall supersede or modify the terms of any separate license agreement you 143 | may have executed with Licensor regarding such Contributions. 144 | 145 | 6. Trademarks. This License does not grant permission to use the trade names, 146 | trademarks, service marks, or product names of the Licensor, except as required 147 | for reasonable and customary use in describing the origin of the Work and 148 | reproducing the content of the NOTICE file. 149 | 150 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to 151 | in writing, Licensor provides the Work (and each Contributor provides its 152 | Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 153 | KIND, either express or implied, including, without limitation, any warranties 154 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR 155 | A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness 156 | of using or redistributing the Work and assume any risks associated with Your 157 | exercise of permissions under this License. 158 | 159 | 8. Limitation of Liability. In no event and under no legal theory, whether 160 | in tort (including negligence), contract, or otherwise, unless required by 161 | applicable law (such as deliberate and grossly negligent acts) or agreed to 162 | in writing, shall any Contributor be liable to You for damages, including 163 | any direct, indirect, special, incidental, or consequential damages of any 164 | character arising as a result of this License or out of the use or inability 165 | to use the Work (including but not limited to damages for loss of goodwill, 166 | work stoppage, computer failure or malfunction, or any and all other commercial 167 | damages or losses), even if such Contributor has been advised of the possibility 168 | of such damages. 169 | 170 | 9. Accepting Warranty or Additional Liability. While redistributing the Work 171 | or Derivative Works thereof, You may choose to offer, and charge a fee for, 172 | acceptance of support, warranty, indemnity, or other liability obligations 173 | and/or rights consistent with this License. However, in accepting such obligations, 174 | You may act only on Your own behalf and on Your sole responsibility, not on 175 | behalf of any other Contributor, and only if You agree to indemnify, defend, 176 | and hold each Contributor harmless for any liability incurred by, or claims 177 | asserted against, such Contributor by reason of your accepting any such warranty 178 | or additional liability. END OF TERMS AND CONDITIONS 179 | 180 | APPENDIX: How to apply the Apache License to your work. 181 | 182 | To apply the Apache License to your work, attach the following boilerplate 183 | notice, with the fields enclosed by brackets "[]" replaced with your own identifying 184 | information. (Don't include the brackets!) The text should be enclosed in 185 | the appropriate comment syntax for the file format. We also recommend that 186 | a file or class name and description of purpose be included on the same "printed 187 | page" as the copyright notice for easier identification within third-party 188 | archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | 194 | you may not use this file except in compliance with the License. 195 | 196 | You may obtain a copy of the License at 197 | 198 | http://www.apache.org/licenses/LICENSE-2.0 199 | 200 | Unless required by applicable law or agreed to in writing, software 201 | 202 | distributed under the License is distributed on an "AS IS" BASIS, 203 | 204 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 205 | 206 | See the License for the specific language governing permissions and 207 | 208 | limitations under the License. 209 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://img.shields.io/badge/STATUS-NOT%20CURRENTLY%20MAINTAINED-red.svg?longCache=true&style=flat) 2 | 3 | # Important Notice 4 | This public repository is read-only and no longer maintained. For the latest sample code repositories, visit the [SAP Samples](https://github.com/SAP-samples) organization. 5 | 6 | # Virtual Event - SAP Cloud Platform Workflow 7 | 8 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cloud-platform-workflow-virtual-event)](https://api.reuse.software/info/github.com/SAP-samples/cloud-platform-workflow-virtual-event) 9 | 10 | ## Description 11 | 12 | This repository contains the material for the virtual event on SAP Cloud Platform Workflow. It is based upon the original [CodeJam - SAP Cloud Platform Workflow](https://github.com/SAP-samples/cloud-workflow-codejam/) content. 13 | 14 | Prerequisites and recommendations for this virtual event are documented in the [prerequisites](prerequisites.md) file. 15 | 16 | ### Virtual event overview 17 | 18 | This SAP Cloud Platform Workflow virtual event brings together, over a series of ten exercises, a number of SAP Cloud Platform topics, centred around the SAP Cloud Platform Workflow service, but also covers setting up the SAP Cloud Connector to establish connectivity to an on-prem environment, using the SAP Cloud Platform Portal service to create an SAP Fiori launchpad site, exploring the SAP API Business Hub and using the Workflow API directly. From the Workflow service perspective you'll create, deploy and extend a workflow definition, interact with tasks in the standard My Inbox app and monitor & inspect workflow instances, initiating them from the monitor itself and from a 3rd party application. 19 | 20 | ### Material organization 21 | 22 | The material consists of a series of exercises that are to be done in order (each one building on the previous one). Each exercise is contained in a directory, with a main 'readme' file containing the core exercise instructions, with optional supporting files, such as screenshots and sample files. 23 | 24 | ### Following the exercises 25 | 26 | During the virtual event you will complete each exercise one at a time. At the end of each exercise there are questions; these are designed to help you think about the content just covered, and are to be discussed with the entire class, led by the instructors, when everyone has finished that exercise. 27 | 28 | If you finish an exercise early, please resist the temptation to continue with the next one. Instead, explore what you've just done and see if you can find out more about the subject that was covered. That way we all stay on track together and can benefit from some reflection via the questions (and answers). 29 | 30 | :point_right: Where there's an action for you to perform, it will be prefixed with this pointing symbol, to help you focus on where you are in each exercise. 31 | 32 | > The management tools in SAP Cloud Platform have recently undergone renovation, and there is now the concept of tool "[feature sets](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/caf4e4e23aef4666ad8f125af393dfb2.html)". Throughout this virtual event, the descriptions and screenshots will be from a "Feature Set B" environment. 33 | 34 | ### The exercises 35 | 36 | Here's an overview of the exercises. 37 | 38 | - [Exercise 01 - Setting up for Workflow on SAP Cloud Platform](exercises/01/) 39 | - [Exercise 02 - Deploying the Workflow tools](exercises/02/) 40 | - [Exercise 03 - Installing & configuring the SAP Cloud Connector](exercises/03) 41 | - [Exercise 04 - Establishing a destination in SAP Cloud Platform](exercises/04) 42 | - [Exercise 05 - Creating, deploying & instantiating a simple workflow](exercises/05) 43 | - [Exercise 06 - Exploring the API Hub and the Workflow API](exercises/06) 44 | - [Exercise 07 - Calling the Workflow API from Postman](exercises/07) 45 | - [Exercise 08 - Adding a Service Task to the workflow definition](exercises/08) 46 | - [Exercise 09 - Adding a User Task to the workflow definition](exercises/09) 47 | - [Exercise 10 - Accessing contextual information in a Script Task](exercises/10) 48 | 49 | ### Further experimentation 50 | 51 | If you want to further your learning based on what you've built in these exercises, we suggest you extend the workflow definition you've created to add more features. For example, you could set up a Mail Task with appropriate configuration to send a message. 52 | 53 | You could also look at branching in the flow, based on decisions, using the Exclusive or Parallel Gateways. 54 | 55 | Events are also powerful features that you could investigate. For example, try controlling the flow of your workflow instances via remote API calls by making use of Intermediate Messages, that pause execution until an incoming message is received (via an API call). 56 | 57 | For more in-depth coverage of some of the topics in this virtual event, you may find the blog post series [Discovering SCP Workflow](https://qmacro.org/2018/01/16/discovering-scp-workflow/) worth a look. 58 | 59 | 60 | ## Requirements 61 | 62 | The requirements to follow the exercises in this repository, including hardware and software, are detailed in the [prerequisites](prerequisites.md) file. 63 | 64 | 65 | ## Download and installation 66 | 67 | You do not need to download this repository nor install anything from it. You can just follow the exercises by visiting each of them as listed in the [exercises](#the-exercises) section. 68 | 69 | 70 | ## How to obtain support 71 | 72 | Support for the content in this repository is available during virtual events, for which this content has been designed. Otherwise, this content is provided "as-is" with no other support. 73 | 74 | 75 | ## Contributing 76 | 77 | If you wish to contribute code, offer fixes or improvements, please send a pull request (PR). Due to legal reasons, contributors will be asked to accept a [Developer Certificate of Origin (DCO)](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin) on submitting their first PR to this project. This DCO acceptance can be done in the PR itself - look out for the CLA assistant that will guide you through the simple process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/). 78 | 79 | ## License 80 | 81 | Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License version 2.0. 82 | -------------------------------------------------------------------------------- /exercises/01/appstudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/appstudio.png -------------------------------------------------------------------------------- /exercises/01/bas-subscribe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/bas-subscribe.png -------------------------------------------------------------------------------- /exercises/01/boostertile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/boostertile.png -------------------------------------------------------------------------------- /exercises/01/bpmservice-rolecollection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/bpmservice-rolecollection.png -------------------------------------------------------------------------------- /exercises/01/collectionassigned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/collectionassigned.png -------------------------------------------------------------------------------- /exercises/01/destinations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/destinations.png -------------------------------------------------------------------------------- /exercises/01/devspaceavailable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/devspaceavailable.png -------------------------------------------------------------------------------- /exercises/01/devspaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/devspaces.png -------------------------------------------------------------------------------- /exercises/01/newdevspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/newdevspace.png -------------------------------------------------------------------------------- /exercises/01/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 01 - Setting up for Workflow on SAP Cloud Platform 2 | 3 | In this exercise you'll set up and configure the basic aspects that you'll need to complete this Workflow Virtual Event on SAP Cloud Platform, specifically in the Cloud Foundry (CF) environment. 4 | 5 | This exercise assumes you have a fresh SAP Cloud Platform trial account; you may have to make adjustments if you've used some of your quota already on an existing trial account. 6 | 7 | From a service perspective, you'll be using a number of services: 8 | 9 | - Workflow: the engine and infrastructure that supports workflow generally 10 | - Portal: to support the Fiori Launchpad (FLP) site which will host the Workflow-related apps 11 | - HTML5 Application Repository: where the core Workflow-related apps are stored and served from 12 | - Authorization & Trust Management: to manage application authorizations and trust to identity providers 13 | 14 | You will also need an editor, or an Integrated Development Environment (IDE) to create and maintain your workflow definitions. For that you will be using the SAP Business Application Studio. 15 | 16 | Finally, you'll be wearing different hats throughout this Virtual Event, using your SAP Cloud Platform trial user. To that end, you'll need appropriate roles, such as the following: 17 | 18 | - Workflow Admin 19 | - Workflow Context Viewer 20 | - Workflow Developer 21 | - Workflow Initiator 22 | - Workflow Participant 23 | 24 | This exercise helps you get started with setting some of these things up, with the aid of an SAP Cloud Platform [booster](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/fb1b56148f834749a2bf51127421610b.html). 25 | 26 | ## Steps 27 | 28 | After completing the steps in this exercise you'll have appropriate roles set up and assigned to your user, an IDE set up and configured to work with Workflow artifacts, and an instance of the main Workflow service set up, alongside instances of some other related services. Instances of the Authorization & Trust Management and HTML5 Application Repository services mentioned earlier will be set up in the next exercise. 29 | 30 | ### 1. Log on to the SAP Cloud Platform Cockpit and look around 31 | 32 | You'll be managing and using services via the SAP Cloud Platform Cockpit in this Virtual Event, so it's worth spending a couple of minutes making yourself familiar with it. 33 | 34 | :point_right: Go to the trial cockpit landing page at and log on if you're not already authenticated. You should be presented with a welcome page, with a button to "Enter Your Trial Account". 35 | 36 | On entering your trial account, if you've created your SAP Cloud Platform trial account according to the [prerequisites](../../prerequisites.md), you should see something like this, showing a single SAP Cloud Platform subaccount named "trial" (this is the default name for a new, automatically provisioned subaccount) within your trial global account: 37 | 38 | ![trial subaccount shown within global account](subaccounts.png) 39 | 40 | :point_right: Select your "trial" subaccount to get an overview, where you'll see that a CF organization has also been automatically provisioned for you and linked to the subaccount. If you chose the default location, the API endpoint for your CF organization will also be `https://api.cf..hana.ondemand.com` where region denotes the geographical location, such as `eu10` or `us10`. Note also that a default space called "dev" has been set up for you too: 41 | 42 | ![subaccount overview](subaccountoverview.png) 43 | 44 | :point_right: We'll be coming back to this page a number of times over the course of this Virtual Event, so it's a good idea to give this page a name we can refer to, and also to bookmark it. Let's call it "Trial Subaccount Home". Bookmark it now, with this name. 45 | 46 | :point_right: In the menu on the left hand side, select "Spaces" (this may now be a sub menu item within "Cloud Foundry") to see the list of spaces in the CF organization - this should show your "dev" space as a tile, including the quota assigned to it and how much of that quota has been used. A newly provisioned CF organization and space should have adequate resources available for what we want to achieve in this Virtual Event today: 47 | 48 | ![space detail](spacedetail.png) 49 | 50 | 51 | ### 2. Use a booster to set up service instances and related artifacts 52 | 53 | At this point you're ready to provision the service instances you'll need for your work with the Workflow service. Until recently, this was done manually but the advent of SAP Cloud Platform [boosters](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/fb1b56148f834749a2bf51127421610b.html) make things simpler. 54 | 55 | There's a booster available for Workflow Management. Boosters can be found via the corresponding menu item - which is at the global account level. 56 | 57 | :point_right: Use the breadcrumb trail at the top of the cockpit page to navigate back to the global account level. If you're following on from where you left off in the previous step, where you were viewing the "dev" space tile in the CF organization relating to your trial subaccount, the breadcrumb trail will look something like this: 58 | 59 | ``` 60 | Trial Home / 898789e9trial / trial 61 | ``` 62 | 63 | In this example, `898789e9trial` represents the global account, and `trial` represents the subaccount. 64 | 65 | :point_right: Select the Boosters menu item and find the "Set up account for Workflow Management booster"; you can filter for it with the "Extension Suite - Digital Process Automation" value as shown. 66 | 67 | ![The booster](boostertile.png) 68 | 69 | The booster enables automatic setup of Cloud Platform artifacts focused around a certain topic or set of services. This one, relating to Workflow Management, actually sets up more than we'll need for this Virtual Event - it includes Business Rules and Process Visibility related artifacts. But that's fine for now; the important thing is that it will do the following for us: 70 | 71 | - set appropriate service quotas 72 | - create relevant service instances 73 | - define destinations 74 | - create and assign a role collection 75 | 76 | :point_right: Start the booster, and wait for it to complete. 77 | 78 | 79 | ### 3. Check what the booster did for you 80 | 81 | You may be curious as to exactly what the booster did. We got a rough idea from the progress indicator that was shown while the booster was working. But now let's take a quick look ourselves. 82 | 83 | > In case you're wondering, the booster automatically identified and used the trial subaccount. 84 | 85 | First, let's check the service instances. 86 | 87 | :point_right: Use the Trial Subaccount Home bookmark you created earlier in this exercise, and you'll see on arriving at the subaccount, with the CF environment details displayed, that you now have a number of service instances in your "dev" space. Select that number to jump directly to the instance list, whereupon you'll see something like this: 88 | 89 | ![List of service instances](serviceinstances.png) 90 | 91 | > There are other service instances shown in this screenshot, you can ignore those. 92 | 93 | Notice that not only do you now have an instance of the Workflow service, but also instances of the Portal service, the Business Rules service, the Process Visibility service and the Connectivity service. These have all been set up by the booster. You won't be needing the Process Visibility or Business Rules service instances, but it's fine to leave them there for now. 94 | 95 | Now let's check the destinations. 96 | 97 | :point_right: Use the Trial Subaccount Home bookmark again and select Destinations from the left hand menu. 98 | 99 | You should see that two destinations have been set up, both relating to the Business Rules service. Again, you can leave them as they are, although we won't be using them in this Virtual Event. 100 | 101 | ![Business Rules related destinations](destinations.png) 102 | 103 | Finally, let's check the security artifacts that have been set up. 104 | 105 | :point_right: Within the Security entry in the left hand menu, select the Role Collections item. 106 | 107 | You should see a new Role Collection has been defined, called "BPMService", containing a fair number of Roles, relating to Process Visibility (prefixed with "PV"), the Business Rules service, and of course the Workflow service. You should also be able to see that this Role Collection has been assigned to your user. 108 | 109 | ![Role Collection BPMService](bpmservice-rolecollection.png) 110 | Great! At this stage you're all set with the main Workflow service and have access to use it. 111 | 112 | 113 | ### 4. Set up the IDE 114 | 115 | Now it's time to set up the IDE you'll be using, which in this case is the [SAP Business Application Studio](https://help.sap.com/viewer/9d1db9835307451daa8c930fbd9ab264/Cloud/en-US/8f46c6e6f86641cc900871c903761fd4.html), which we'll refer to henceforth as the App Studio. 116 | 117 | The App Studio facility is available on SAP Cloud Platform via a subscription, meaning getting access to it is rather straightforward. 118 | 119 | **Setting up a subscription** 120 | 121 | :point_right: Use the Trial Subaccount Home bookmark to jump to your subaccount overview, and select the Subscriptions menu item on the left hand side. Find and select the "SAP Business Application Studio" tile and use the "Subscribe" button to create a subscription to it in your account. 122 | 123 | ![The Subscribe button for the SAP Business Application Studio](bas-subscribe.png) 124 | 125 | Once subscribed, you'll see the "Go to Application" link become active. But before you attempt to launch it, you must ensure that you have the appropriate [App Studio roles](https://help.sap.com/viewer/9d1db9835307451daa8c930fbd9ab264/Cloud/en-US/01e69c53003c4b0a8a64310a3f08867d.html). 126 | 127 | :point_right: Jump to your subaccount overview page with the Trial Subaccount Home bookmark, and select the "Trust Configuration" item within the "Security" entry in the menu on the left hand side. Select the "sap.default" entry as shown in the screenshot (it may be a different name, but it is usually going to be the only entry to select anyway), and in the following screen, enter your ID - the email address associated with your account - and select the "Show Assignments" button to bring up the current list, and to give you the ability to assign further Role Collections. 128 | 129 | ![Trust Configuration](trustconfiguration.png) 130 | 131 | :point_right: Use the "Assign Role Collection" dialog box to select and assign these Role Collections: 132 | 133 | - Business_Application_Studio_Administrator 134 | - Business_Application_Studio_Developer 135 | 136 | ![Assigning App Studio Role Collections](rolecollectionassignment.png) 137 | 138 | Now you should be able to start up and access the App Studio subscription. 139 | 140 | 141 | **Starting up the App Studio & creating a Dev Space** 142 | 143 | :point_right: Go back to the App Studio subscription page, and use the "Go to Application" link you saw earlier. 144 | 145 | The App Studio has the concept of "Dev Spaces", separate, multiple, development environments individually tailored with tools for different tasks. The landing page you see when starting App Studio for the first time gives you the opportunity to create one of these spaces, and we'll use the opportunity to create one with tools specifically for this Virtual Event. 146 | 147 | ![Dev Spaces page](devspaces.png) 148 | 149 | :point_right: Select the "Create Dev Space" button to get to the place where you can and should specify a name for your space, and the extensions you want. Use the name "Workflow", start with the "Basic" space option, and make sure you select these additional SAP extensions: 150 | 151 | - Launchpad Module 152 | - MTA Tools 153 | - Workflow Management 154 | 155 | ![Create a new Dev Space](newdevspace.png) 156 | 157 | > The Launchpad Module is not directly required, but it will enable a more comfortable exploration of FLP site configuration files such as `CommonDataModel.json` that we will see in the next exercise. 158 | 159 | :point_right: Once you've made the appropriate settings, use the "Create Dev Space" button to initiate the creation of the space, which should take only a few moments, and result in its availability being presented to you, whereupon you can access it via the "Workflow" name link. 160 | 161 | ![Dev Space available](devspaceavailable.png) 162 | 163 | For those already acquainted with IDEs such as VS Code, SAP Business Application Studio should be happily familiar to you. 164 | 165 | ![App Studio](appstudio.png) 166 | 167 | 168 | **Connecting to CF** 169 | 170 | There's one final activity you should complete at this stage, and that's to point your new Dev Space to your CF organization and space, ready for deployments later in this Virtual Event. Let's do that now. 171 | 172 | :point_right: In the bar at the bottom, there'll be a message along these lines: "The organization and space in Cloud Foundry have not been set". Select this message to initiate a short UI interaction at the top of the screen to allow you to confirm the settings. Specify the following: 173 | 174 | |Setting|Value to set| 175 | |-------|-----------| 176 | |Cloud Foundry endpoint|This is the endpoint you saw in an earlier step in this exercise in the form `https://api.cf..hana.ondemand.com`. Refer to the details shown in your Trial Subaccount overview page (open up the Trial Subaccount Home bookmark in a separate tab to see this, if you need to check).| 177 | |Email address|This is the email address associated with your Cloud Platform account.| 178 | |Password|This is the password associated with the email address and this account.| 179 | |Organization|This is the CF organization associated with your trial subaccount. If you need to, check what this is in the Trial Subaccount overview page - it will be a series of hexadecimal values suffixed with 'trial').| 180 | |Space|This is the space within the organization you just selected. If this is a freshly set up trial account, the name of the space is likely to be "dev".| 181 | 182 | That's it! You should get a message confirming that the Dev Space is now connected to your CF organization and space. 183 | 184 | ![target message](targetmessage.png) 185 | 186 | At this point, it's worth creating a bookmark for this App Studio Dev Space, as you'll be returning to it often over the course of this Virtual Event. 187 | 188 | :point_right: Create a bookmark for this Dev Space and call it "App Studio Workflow Dev Space". 189 | 190 | 191 | ## Summary 192 | 193 | At this point you're all set up to embark upon your Workflow service journey, with an instance of the main Workflow service available to you, and an IDE that can help you build and manage workflow definitions and make deployments to your environment on SAP Cloud Platform. 194 | 195 | 196 | ## Questions 197 | 198 | 1. What are the relationships between SAP Cloud Platform subaccounts, Cloud Foundry organizations and spaces? 199 | -------------------------------------------------------------------------------- /exercises/01/rolecollection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/rolecollection.png -------------------------------------------------------------------------------- /exercises/01/rolecollectionassignment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/rolecollectionassignment.png -------------------------------------------------------------------------------- /exercises/01/serviceinstances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/serviceinstances.png -------------------------------------------------------------------------------- /exercises/01/servicemarketplace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/servicemarketplace.png -------------------------------------------------------------------------------- /exercises/01/spacedetail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/spacedetail.png -------------------------------------------------------------------------------- /exercises/01/subaccountoverview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/subaccountoverview.png -------------------------------------------------------------------------------- /exercises/01/subaccounts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/subaccounts.png -------------------------------------------------------------------------------- /exercises/01/targetmessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/targetmessage.png -------------------------------------------------------------------------------- /exercises/01/trustconfigoverview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/trustconfigoverview.png -------------------------------------------------------------------------------- /exercises/01/trustconfiguration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/trustconfiguration.png -------------------------------------------------------------------------------- /exercises/01/workflowoverview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/01/workflowoverview.png -------------------------------------------------------------------------------- /exercises/02/BPMServicesFLP.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/BPMServicesFLP.zip -------------------------------------------------------------------------------- /exercises/02/applicationoverview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/applicationoverview.png -------------------------------------------------------------------------------- /exercises/02/bpmserviceflpproject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/bpmserviceflpproject.png -------------------------------------------------------------------------------- /exercises/02/bpmservicesflpzip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/bpmservicesflpzip.png -------------------------------------------------------------------------------- /exercises/02/buildmtacommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/buildmtacommand.png -------------------------------------------------------------------------------- /exercises/02/deploymtaarchivecommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/deploymtaarchivecommand.png -------------------------------------------------------------------------------- /exercises/02/devspacedetail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/devspacedetail.png -------------------------------------------------------------------------------- /exercises/02/flpsite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/flpsite.png -------------------------------------------------------------------------------- /exercises/02/openworkspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/openworkspace.png -------------------------------------------------------------------------------- /exercises/02/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 02 - Deploying the Workflow tools 2 | 3 | In this exercise, you'll import a complete project into your IDE, build it, and deploy it to your Cloud Foundry (CF) "dev" space in the organization associated with your SAP Cloud Platform subaccount. This project contains everything you need to have a Fiori launchpad (FLP) site set up for you using the Portal service, and have injected into it tiles appropriate for accessing the Workflow related tools which you'll be using throughout the rest of this Virtual Event. 4 | 5 | 6 | ## Steps 7 | 8 | After completing these steps you'll have an FLP site with, amongst other things, an app for viewing and processing Workflow items ("My Inbox") and a "Workflow Monitor" app for monitoring, starting and interacting with workflow definitions and instances. 9 | 10 | 11 | ### 1. Download the project ZIP file 12 | 13 | The GitHub repository [SAP-samples/cloud-process-visibility](https://github.com/SAP-samples/cloud-process-visibility) contains a number of release artifacts. It's from here that you can download the project which contains all you need. 14 | 15 | :point_right: Jump directly to the repository's [1.0.0 Release](https://github.com/SAP-samples/cloud-process-visibility/releases/tag/1.0.0) page and download the [BPMServicesFLP.zip](https://github.com/SAP-samples/cloud-process-visibility/releases/download/1.0.0/BPMServicesFLP.zip) file. 16 | 17 | ![BPMServicesFLP.zip file](bpmservicesflpzip.png) 18 | 19 | Once you have the ZIP file downloaded, unpack it into its own "BPMServicesFLP" directory. Here's what that looks like on a local computer: 20 | 21 | ``` 22 | i347491@C02CH7L4MD6T [~/Downloads] 23 | ▶ tree 24 | . 25 | ├── BPMServicesFLP 26 | │   ├── BPMFLP 27 | │   │   ├── README.md 28 | │   │   ├── package.json 29 | │   │   ├── portal-site 30 | │   │   │   ├── CommonDataModel.json 31 | │   │   │   ├── business-apps 32 | │   │   │   │   └── business-rules.json 33 | │   │   │   └── i18n 34 | │   │   │   ├── defaultCatalogId.properties 35 | │   │   │   ├── defaultGroupId.properties 36 | │   │   │   └── workflow.properties 37 | │   │   └── xs-app.json 38 | │   ├── BPMServicesFLP_appRouter 39 | │   │   ├── package.json 40 | │   │   └── xs-app.json 41 | │   ├── mta.yaml 42 | │   └── xs-security.json 43 | └── BPMServicesFLP.zip 44 | 45 | 6 directories, 13 files 46 | ``` 47 | 48 | ### 2. Bring the project into App Studio 49 | 50 | It's easy to bring such a project into your App Studio Dev Space. First, you need to make sure that you have a workspace opened in the Explorer. Then, you just need to drag the project directory into there. 51 | 52 | :point_right: Switch to the Explorer perspective in App Studio using the documents icon in the far left hand side, and use the Open Workspace button to select and open the "projects" directory. 53 | 54 | ![Open Workspace button](openworkspace.png) 55 | 56 | > The App Studio gives you a local filesystem to work within; it even has a Terminal that you can start up, to navigate that filesystem and run commands. 57 | 58 | :point_right: Using your local computer's file system tools, find and drag the "BPMServicesFLP" directory into the Explorer space in the App Studio, and expand it. You should end up with something that looks like this: 59 | 60 | ![BPMServiceFLP project](bpmserviceflpproject.png) 61 | 62 | 63 | ### 3. Explore the project contents 64 | 65 | What is there in this project? What are the different files and directories? What's going to happen next? It's worth taking a couple of minutes to [stare](https://langram.org/2017/02/19/the-beauty-of-recursion-and-list-machinery/#initialrecognition) at the contents of this project to understand some details of what we're about to deploy. 66 | 67 | :point_right: Take a look through the file and directory structure, which you can see by navigating it in the Explorer perspective (you can also see the details in the tree structure above). 68 | 69 | Here's what you'll see, in an order that will hopefully make sense: 70 | 71 | > In case you're left still wondering - the `.che/` directories are specific to the IDE itself, we can safely ignore those at this level of exploration. 72 | 73 | **File: `mta.yaml`** 74 | 75 | The `mta.yaml` file within the project contains the definitions of the modules that will be deployed to SAP Cloud Platform, and also a specification of the resources upon which these modules rely. There are two modules defined: 76 | 77 | |Module|Description| 78 | |-|-| 79 | |`BPMFLP`|When deployed, this module will cause application and tile definitions to be added to the FLP site. The module itself is to be found in the `BPMFLP/` directory in the project structure. It relies upon instances of a number of services, including the Workflow and Portal services. This module executes as a one-time [task](https://blogs.sap.com/2019/05/01/cloudfoundryfun-4-fetch-football-scores-periodically/), and stops upon completion. Keep this in mind when you look at the applications in the SAP Cloud Platform Cockpit later on - it will be in a "Stopped" (i.e. completed) state. 80 | |`BPMServicesFLP_appRouter`|This is the Approuter-based module that handles traffic to and serves the FLP site and apps within it. It relies upon instances of the same services as the `BPMFLP` module, plus another one - the HTML5 Application Repository service.| 81 | 82 | **File: xs-security.json** 83 | 84 | This file contains the parameters that are relevant when creating an instance of the Authorization & Trust Management service (also known as "xsuaa"); in the `mta.yaml` file, the definition of the resource `uaa_bpmservices` (upon which both modules rely) includes a reference to this file. 85 | 86 | **Directory: `BPMFLP/`** 87 | 88 | This directory contains the files for the `BPMFLP` module. Taking a brief look inside, we see that it's a Node.js based module, where (by looking in the `package.json` file) we see that content is deployed by means of the `@sap/portal-cf-content-deployer` package. The content itself is to be found defined in the `portal-site/` subdirectory. 89 | 90 | **Directory: `BPMServicesFLP_appRouter`** 91 | 92 | Not unexpectedly, this directory contains the files for the `BPMServicesFLP_appRouter` module. Looking inside this directory's `package.json` file, we see that the `@sap/approuter` is employed. The `xs-app.json` file is what the Approuter uses to know what to serve, and how. 93 | 94 | 95 | ### 4. Build the MTA archive ready for deployment 96 | 97 | While the project contents are fascinating, they aren't going to do you much good just sitting there in the IDE. So now it's time to get everything up into the cloud. The project is in the form of a Multi-Target Application, or MTA for short; this is why the `mta.yaml` file is at the heart of everything here. To bring the project contents to the Cloud Platform, you'll first need to build an archive containing the project contents, and then deploy that archive. This step is where you build the archive. 98 | 99 | :point_right: Use the context menu on the `mta.yaml` file in the Explorer, and select "Build MTA". 100 | 101 | ![Build MTA command](buildmtacommand.png) 102 | 103 | A task window will open up showing you the progress of this build task. You can see the exact command that was invoked, right at the top: 104 | 105 | ``` 106 | mbt build -s '/home/user/projects/BPMServicesFLP'; sleep 2; 107 | ``` 108 | 109 | Towards the end of the process you'll see progress log records that look like this: 110 | 111 | ``` 112 | [2020-07-16 13:34:13] INFO generating the MTA archive... 113 | [2020-07-16 13:34:14] INFO the MTA archive generated at: /home/user/projects/BPMServicesFLP/mta_archives/BPMServicesFLP_0.0.1.mtar 114 | ``` 115 | 116 | :point_right: Look in the Explorer, and you'll see that an archive file, with an `mtar` extension, has been generated and placed in a new `mta_archives/` directory. This archive file is what is to be deployed in the next step. 117 | 118 | 119 | ### 5. Deploy the MTA archive to Cloud Platform 120 | 121 | At this stage you're ready to deploy the project contents, in the form of the archive that has just been built, to the CF environment of your Cloud Platform trial account. 122 | 123 | :point_right: Use the context menu on the `mtar` file and select "Deploy MTA Archive". 124 | 125 | ![Deploy MTA Archive command](deploymtaarchivecommand.png) 126 | 127 | Because you've already connected your App Studio Dev Space "Workflow" to your CF Foundry organization and space, the deployment should start immediately. Again, as well as the progress, the task window shows you the command that was invoked: 128 | 129 | ``` 130 | cf deploy /home/user/projects/BPMServicesFLP/mta_archives/BPMServicesFLP_0.0.1.mtar 131 | ``` 132 | 133 | After a short time the deployment will complete, and you should see a log message in the output like this, towards the end: 134 | 135 | ``` 136 | Application "BPMServicesFLP_appRouter" started and available 137 | at "898789e9trial-dev-bpmservicesflp-approuter.cfapps.eu10.hana.ondemand.com" 138 | ``` 139 | 140 | This is the URL of the `BPMServicesFLP_appRouter` module that has been deployed, and will be specific to your Cloud Platform trial subaccount. You could use this URL right now to get to the FLP site, but instead, let's take another, slightly more long winded but definitely more interesting route. 141 | 142 | 143 | ### 6. Find the FLP site URL and get to the Workflow tiles 144 | 145 | In the final step in this exercise, you should get to the Workflow tiles in the FLP site. 146 | 147 | :point_right: In a new browser tab, use the Trial Subaccount Home bookmark you saved earlier to get back to your subaccount overview in the cockpit. You should now see, in the "Spaces" section, that there are a couple of applications, and yet more service instances. 148 | 149 | ![Space oveview](spaceoverview.png) 150 | 151 | > The number of service instances that you will see may be different to what is shown in these screenshots. There should be 7 in total now that are related to this Virtual Event. 152 | 153 | :point_right: Use the "Spaces" menu item on the left hand side to jump to the summary of spaces, and you'll also see a similar reflection of reality, where memory and service quota have been consumed, and there are two applications, one started and one stopped: 154 | 155 | ![Dev space detail](devspacedetail.png) 156 | 157 | :point_right: Select the "dev" space and you should be brought initially to the list of applications. There you should see entries for the two modules defined in the `mta.yaml` file earlier - `BPMFLP` and `BPMServicesFLP_appRouter`. As expected, the `BPMFLP` application is in a "Stopped" state, as the task that it carried out completed. 158 | 159 | :point_right: Now select the "Service Instances" menu item (a subitem within "Services" in the left hand side menu), whereupon you will be shown not only the service instances you saw earlier, but also two more, reflecting the HTML5 Application Repository service and the Authorization & Trust Management service. 160 | 161 | ![Service instance list](serviceinstancelist.png) 162 | 163 | :point_right: From here, select one of the `BPMServicesFLP_appRouter` links in the "Referencing Applications" column to quickly jump to the details of that application; it will take you initially to the "Service Bindings" section: 164 | 165 | ![Service bindings](servicebindings.png) 166 | 167 | :point_right: From there select the "Overview" menu item to see general information about the `BPMServicesFLP_appRouter` application, which includes the "Application Routes" section. There's a single route URL shown for this application, and yes, you guessed it, it's the one shown in the deployment log earlier: 168 | 169 | ![application overview](applicationoverview.png) 170 | 171 | You're almost there! 172 | 173 | :point_right: Select the route URL and, after any standard authentication challenge screen which you must complete using your SAP Cloud Platform trial email address and password, you'll see what you've been waiting for this whole time - a lovely Fiori launchpad site with the "My Inbox" and "Monitor Workflows" tiles: 174 | 175 | ![FLP site](flpsite.png) 176 | 177 | Not only that, but as a reward for coming such a long way round (just kidding), you also get tiles for Business Rules and Process Visibility apps. How about that! 178 | 179 | 180 | ## Summary 181 | 182 | Not only do you have an instance of the main Workflow service now, but also access to your own FLP site with the "My Inbox" app for managing workflow related task items, and a pair of "Monitor Workflows" apps for managing workflow definitions and instances. But you also have some insight into how MTAs work and what the relationship is between modules and resources defined in MTA descriptor files. 183 | 184 | Good work! 185 | 186 | ## Questions 187 | 188 | 1. Why is the `BPMFLP` app not listed in the "Referencing Applications" column for the instance of the html5-apps-repo service? 189 | 190 | 2. What do you think the difference between a "workflow instance" and a "workflow definition" is? 191 | 192 | 3. What are all the services upon which the BPMFLP module relies? 193 | -------------------------------------------------------------------------------- /exercises/02/servicebindings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/servicebindings.png -------------------------------------------------------------------------------- /exercises/02/serviceinstancelist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/serviceinstancelist.png -------------------------------------------------------------------------------- /exercises/02/spaceoverview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/02/spaceoverview.png -------------------------------------------------------------------------------- /exercises/03/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | RUN yum -y install initscripts which unzip wget net-tools less 4 | 5 | COPY sapdownloads /tmp/sapdownloads/ 6 | WORKDIR /tmp/sapdownloads/ 7 | 8 | RUN unzip sapcc*.zip && \ 9 | rpm -i sapjvm*.rpm && \ 10 | rpm -i com.sap.scc*.rpm 11 | 12 | RUN chsh -s /bin/bash sccadmin 13 | 14 | EXPOSE 8443 15 | USER sccadmin 16 | WORKDIR /opt/sap/scc 17 | 18 | CMD /opt/sapjvm_8/bin/java \ 19 | -server \ 20 | -XtraceFile=log/vm_@PID_trace.log \ 21 | -XX:+GCHistory \ 22 | -XX:GCHistoryFilename=log/vm_@PID_gc.prf \ 23 | -XX:+HeapDumpOnOutOfMemoryError \ 24 | -XX:+DisableExplicitGC \ 25 | -Xms1024m \ 26 | -Xmx1024m \ 27 | -XX:MaxNewSize=512m \ 28 | -XX:NewSize=512m \ 29 | -XX:+UseConcMarkSweepGC \ 30 | -XX:TargetSurvivorRatio=85 \ 31 | -XX:SurvivorRatio=6 \ 32 | -XX:MaxDirectMemorySize=2G \ 33 | -Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=com.sap.scc.tomcat.utils.PropertyDigester \ 34 | -Dosgi.requiredJavaVersion=1.6 \ 35 | -Dosgi.install.area=. \ 36 | -DuseNaming=osgi \ 37 | -Dorg.eclipse.equinox.simpleconfigurator.exclusiveInstallation=false \ 38 | -Dcom.sap.core.process=ljs_node \ 39 | -Declipse.ignoreApp=true \ 40 | -Dosgi.noShutdown=true \ 41 | -Dosgi.framework.activeThreadType=normal \ 42 | -Dosgi.embedded.cleanupOnSave=true \ 43 | -Dosgi.usesLimit=30 \ 44 | -Djava.awt.headless=true \ 45 | -Dio.netty.recycler.maxCapacity.default=256 \ 46 | -jar plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar 47 | -------------------------------------------------------------------------------- /exercises/03/accesssummary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/accesssummary.png -------------------------------------------------------------------------------- /exercises/03/connectionestablished.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/connectionestablished.png -------------------------------------------------------------------------------- /exercises/03/connectionstatus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/connectionstatus.png -------------------------------------------------------------------------------- /exercises/03/jvmdownload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/jvmdownload.png -------------------------------------------------------------------------------- /exercises/03/mappingsummary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/mappingsummary.png -------------------------------------------------------------------------------- /exercises/03/reachablevalidation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/reachablevalidation.png -------------------------------------------------------------------------------- /exercises/03/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 03 - Installing & configuring the SAP Cloud Connector 2 | 3 | The scenario upon which this Virtual Event is based includes access to an on-prem SAP system, for which the SAP Cloud Connector is required. 4 | 5 | > The SAP system we'll be using is not actually on-prem, it's the [public SAP NetWeaver Gateway Demo system](https://blogs.sap.com/2017/06/16/netweaver-gateway-demo-es5-now-in-beta/), known by its System ID "ES5". But for the purposes of understanding and configuring the SAP Cloud Connector, we will treat it as if it is. 6 | 7 | In this exercise you'll set up and configure SAP Cloud Connector, to provide the connection between an on-prem SAP system (ES5) and your subaccount on the SAP Cloud Platform, enabling services and apps running in that subaccount to access specific system endpoints in ES5. 8 | 9 | The setup will be done in a container, to isolate SAP Cloud Connector and the software upon which it relies. This is a good approach not only for Virtual Event scenarios like this where attendees' machines are all different, but also for use within work environments. Docker is used as the container system. 10 | 11 | > This exercise assumes you don't already have any processes listening for HTTP requests on port 8443 of your machine. 12 | 13 | ## Steps 14 | 15 | After completing these steps you'll have an SAP Cloud Connector system running in a container on your machine and connected to your trial account. You'll also have resources in the ES5 system exposed and available through that system too. 16 | 17 | ### 1. Install an SAP Cloud Connector 18 | 19 | Instructions for setting up an SAP Cloud Connector, along with the software upon which it relies, all in a Docker container, is explained in detail in the [nzamani/sap-cloud-connector-docker](https://github.com/nzamani/sap-cloud-connector-docker) repository on GitHub. This repository is accompanied by the blog post "[Installing SAP Cloud Connector into Docker and connecting it to SAP Cloud Platform](https://blogs.sap.com/2018/05/22/installing-sap-cloud-connector-into-docker-and-connecting-it-to-sap-cloud-platform/)" by [Nabi Zamani](https://people.sap.com/pars.man#overview). 20 | 21 | > When following these instructions, [please be aware](https://github.com/nzamani/sap-cloud-connector-docker/blob/a1a673af37b4cc4412b11a6542fb5c9fd26760ad/Dockerfile#L31-L33) of how the mechanism works in relation to the End User License Agreement. 22 | 23 | :point_right: Follow the [instructions](https://github.com/nzamani/sap-cloud-connector-docker#instructions) in this repository to set things up; at the end you should have a Docker container based SAP Cloud Connector up and running, and you should have successfully logged in (at https://localhost:8443) as user "Administrator". 24 | 25 | Once you've done that, return here for the following steps in this README. 26 | 27 | 28 | ### 2. Perform initial setup of the SAP Cloud Connector 29 | 30 | In this step you will use the administration interface to perform some initial setup of the SAP Cloud Connector; in particular, you'll connect it to the SAP Cloud Platform. 31 | 32 | :point_right: Open your browser and go to the SAP Cloud Connector administration UI at [https://localhost:8443](https://localhost:8443). Remember that this is only possible because, with the `-p 8443:8443` parameter earlier, you specified that port 8443 in the container (which is where SAP Cloud Connector is *actually* running and listening) should be exposed to your machine, the container's host (where Docker is running), also on port 8443. 33 | 34 | > Your browser will likely warn you that the site is insecure, because the certificate that the site presents (via HTTPS) has not been signed by any authority it recognizes. This is OK for what we want to achieve in this Virtual Event, and you should proceed through any warning. It's possible to fix this by installing a signed certificate into the SAP Cloud Connector, but this is beyond the scope of this exercise. Check the [Browsers](https://github.com/nzamani/sap-cloud-connector-docker#browsers) section of the other repository for information on how to proceed past the warnings. 35 | 36 | :point_right: If you haven't done already, at the "Cloud Connector Login" page, log in with the default username and password "Administrator" and "manage" and then follow the prompts to change this password, selecting the "Save" icon on the right hand side to proceed (leave other options as they are). 37 | 38 | Next, you're asked to specify an initial subaccount that you want the SAP Cloud Connector to connect to (you can connect it to multiple subaccounts but we will only specify this initial one in this exercise). 39 | 40 | :point_right: Specify the appropriate details for your trial subaccount, as follows: 41 | 42 | - "Region": select the entry that reflects the Cloud Foundry API endpoint URL that is related to the organization connected to your trial subaccount. In other words, you can search by entering `cf` in the selection search box to find and select the appropriate entry, such as "Europe (Frankfurt) - AWS", which corresponds to `cf.eu10.hana.ondemand.com`, or "US East (VA) - AWS", which corresponds to `cf.us10.hana.ondemand.com` 43 | 44 | - "Subaccount": this should be the ID of your trial subaccount, from your "Trial Subaccount Home" page, as shown in this screenshot, where `b844...` is the ID (note there are other IDs relating to connected environments, but it's the subaccount ID that's needed): 45 | 46 | ![subaccount ID](subaccountid.png) 47 | 48 | 49 | - "Display Name": specify anything you want here; we recommend you use the Subdomain name of the subaccount 50 | 51 | - "Login E-Mail" and "Password": these credentials are the ones related to your trial account 52 | 53 | - Leave other parameters as they are, and then complete the initial setup with the "Save" button on the right hand side 54 | 55 | ![subaccount details](subaccountdetails.png) 56 | 57 | At this point, your SAP Cloud Connector, running in a container on your machine, is now up and running with a secure tunnel established to your subaccount on the SAP Cloud Platform. You should see a status page in the SAP Cloud Connector administration UI that looks something like this: 58 | 59 | ![connection status](connectionstatus.png) 60 | 61 | ### 5. Make the SAP backend system available 62 | 63 | Now that the connection is established, you can define access to the on-prem backend SAP system that the SAP Cloud Connector will facilitate. 64 | 65 | > Remember that (a) the secure tunnel is established *outbound* from the SAP Cloud Connector to the SAP Cloud Platform, not the other way round (i.e. connections cannot be initiated from outside your on-prem landscape) and (b) no on-prem system is accessible unless you specify that it is (an "allowlist" approach). 66 | 67 | :point_right: Select the "Cloud To On-Premise" item in the navigation menu on the left hand side, and in the "Mapping Virtual To Internal System" section, create a new system mapping entry with the "+" icon. In the dialog that follows, you can specify the details of your backend SAP system, i.e. the ES5 system: 68 | 69 | | Setting | Value | 70 | | ------------- | ----------------------- | 71 | | Back-end Type | ABAP System | 72 | | Protocol | HTTPS | 73 | | Internal Host | sapes5.sapdevcenter.com | 74 | | Internal Port | 443 | 75 | | Virtual Host | virtuales5 | 76 | | Virtual Port | 8000 | 77 | | Principal Type | None | 78 | | Host in Request Header | Use Virtual Host | 79 | 80 | The dialog summary should look something like this: 81 | 82 | ![system mapping summary](mappingsummary.png) 83 | 84 | :point_right: Select the "Finish" button to create the system mapping. 85 | 86 | :point_right: (Optional) To validate connection to your backend SAP system, select the "Check Availability" (calendar with magnifier) icon under "Actions" and make sure "Check Result" comes back "Reachable" as shown below: 87 | 88 | ![reachable validation](reachablevalidation.png) 89 | 90 | ### 6. Expose a set of resources in the backend system 91 | 92 | While you've established a mapping of a virtual host (that is visible at the SAP Cloud Platform level) to an internal (on-prem) host, there are still no accessible resources available on that host. You must specify these explicitly, and you'll do that now in this step. 93 | 94 | :point_right: In the new "Resources of virtuales5:8000" section that is now visible, add a new resource entry with the "+" icon, specifying the following values and finishing with the "Save" button: 95 | 96 | | Setting | Value | 97 | | ------------- | ----------------------- | 98 | | URL Path | /sap/opu/odata | 99 | | Active | (checked) | 100 | | WebSocket Upgrade | (leave unchecked) | 101 | | Access Policy | Path and all sub-paths | 102 | 103 | This establishes access to OData services, specifically those at path `/sap/opu/odata`. Many standard OData services in an SAP system are available here, and the one we'll use later is too. 104 | 105 | > For test purposes, you could also have specified simply `/` as the URL Path to make every HTTP-based resource in the ES5 system available. 106 | 107 | This is the sort of thing that you should see when you've completed this step: 108 | 109 | ![access summary](accesssummary.png) 110 | 111 | ### 7. Check the connection at the SAP Cloud Platform end 112 | 113 | > This option is currently - and temporarily - unavailable for new Feature Set B based accounts, but has been left in as a step in this exercise for Feature Set A based accounts, and also to show you what it would look like. 114 | 115 | Now the connection is established, you can also check it in your SAP Cloud Platform trial subaccount. 116 | 117 | :point_right: Back on your "Trial Subaccount Home" page in the SAP Cloud Platform Cockpit, select the "Connectivity" item in the navigation menu, and within that, choose the "Cloud Connectors" item. You should see your SAP Cloud Connector connection information, plus the "virtuales5" host you exposed. It should look something like this: 118 | 119 | ![connection established](connectionestablished.png) 120 | 121 | ## Summary 122 | 123 | You've now got your own SAP Cloud Connector running, connected to your SAP Cloud Platform trial subaccount, and exposing OData services on a backend SAP system ready for consumption. Well done! 124 | 125 | ## Questions 126 | 127 | 1. How else could you check that the SAP Cloud Connector was up and running and listening on port 8443? 128 | 129 | 1. What other resource paths might you want to expose in a backend SAP system? 130 | 131 | 1. Do you know the origin of the "opu" part of the `/sap/opu/odata` URL path and what it represents? 132 | 133 | 1. Is the specification of "HTTPS" (as opposed to "HTTP") in the virtual-to-internal system mapping significant? 134 | -------------------------------------------------------------------------------- /exercises/03/sccdownload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/sccdownload.png -------------------------------------------------------------------------------- /exercises/03/subaccountdetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/subaccountdetails.png -------------------------------------------------------------------------------- /exercises/03/subaccountid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/03/subaccountid.png -------------------------------------------------------------------------------- /exercises/04/appentry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/04/appentry.png -------------------------------------------------------------------------------- /exercises/04/approuteurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/04/approuteurl.png -------------------------------------------------------------------------------- /exercises/04/dest-test-app/app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/04/dest-test-app/app.zip -------------------------------------------------------------------------------- /exercises/04/dest-test-app/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | 4 | - name: my-dest-test 5 | random-route: true 6 | buildpacks: 7 | - nodejs_buildpack 8 | memory: 128M 9 | services: 10 | - test-xsuaa 11 | - default_connectivity 12 | - test-destination 13 | -------------------------------------------------------------------------------- /exercises/04/dest-test-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-dest-test", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "start": "node node_modules/@sap/approuter/approuter.js" 6 | }, 7 | "license": "ISC", 8 | "dependencies": { 9 | "@sap/approuter": "^5.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /exercises/04/dest-test-app/prep.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Prepares the app archive and manifest for upload: 4 | # - removes previous app archive 5 | # - creates app archive from core files 6 | # - copies the archive and manifest to the download directory, 7 | # ready for upload via the Cockpit 8 | 9 | # Then uses 'cf push' to deploy directly. 10 | 11 | appname=$(yq r manifest.yml applications[0].name) 12 | echo CF app '${appname}' 13 | 14 | rm app.zip 15 | zip app.zip package.json xs-app.json 16 | cp manifest.yml app.zip ${HOME}/Downloads/ 17 | 18 | cf d ${appname} -f 19 | cf push 20 | 21 | -------------------------------------------------------------------------------- /exercises/04/dest-test-app/xs-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes": [ 3 | { 4 | "source": "/", 5 | "target": "/", 6 | "destination": "shopinfo" 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /exercises/04/dest-test-app/xs-security.json: -------------------------------------------------------------------------------- 1 | { 2 | "xsappname": "my-dest-test", 3 | "tenant-mode": "dedicated", 4 | "description": "Security profile of called application", 5 | "scopes": [ 6 | { 7 | "name": "uaa.user", 8 | "description": "UAA" 9 | } 10 | ], 11 | "role-templates": [ 12 | { 13 | "name": "Token_Exchange", 14 | "description": "UAA", 15 | "scope-references": [ 16 | "uaa.user" 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /exercises/04/neo-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticationMethod":"none", 3 | "routes": [ 4 | { 5 | "path": "/shopinfo", 6 | "target": { 7 | "type": "destination", 8 | "name": "shopinfo" 9 | } 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /exercises/04/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 04 - Establishing a destination in SAP Cloud Platform 2 | 3 | In this exercise you'll define a destination within the context of the "Connectivity" area of SAP Cloud Platform. 4 | 5 | A destination is a collection of parameters that points to a remote service or resource, which might be available on the general Internet or behind a firewall in an on-prem environment. In the latter case an SAP Cloud Connector installed and configured in that on-prem environment enables requests to flow, and that is what we've set up in the previous exercise. 6 | 7 | Once a destination is established, it can be used by apps and services related to that subaccount on the SAP Cloud Platform, which has a very capable [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) mechanism at the heart of the Connectivity service. 8 | 9 | In this case, for the business scenario upon which this Virtual Event is based, the destination will be to a specific OData service providing information relating to an online shop. 10 | 11 | _Note: If you were unable to install Docker (as described in this Virtual Event's [prerequisites](../../prerequisites.md)), you can still continue with this exercise - just follow the special "Without SAP Cloud Connector" instructions where appropriate. You can of course continue with subsequent exercises, as the destination effectively abstracts the actual connection details meaning you can treat it as a logical endpoint after it has been set up._ 12 | 13 | ## Steps 14 | 15 | After completing these steps you'll have created a destination pointing to a specific resource in the ES5 system, and tested it out with a very simple app. 16 | 17 | ### 1. Check the data source 18 | 19 | Before creating the destination, which is effectively a pointer to a data source, it's worth checking that data source manually and directly. First, so you can see for yourself what you're aiming to get to from within the SAP Cloud Platform, and second, so you know what you're looking for when you access that data source indirectly (through the destination). 20 | 21 | The data source is an OData service in the ES5 system, a system to which you should already have access according to the [services section of the prerequisites for this Virtual Event](../../prerequisites.md#services). 22 | 23 | :point_right: Open up the [EPM_REF_APPS_SHOP_SRV](https://sapes5.sapdevcenter.com/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/?sap-client=002) OData service, taking care to specify client 002 in the URL (following the link here will do that for you). 24 | 25 | > If you find that you've forgotten your credentials for the ES5 system, you can visit the [ES5 account administration](https://register.sapdevcenter.com/SUPSignForms/?server=sapes5) page to get your password reset. 26 | 27 | You should see some XML returned, that looks similar to this: 28 | 29 | ![OData service document for EPM_REF_APPS_SHOP_SRV](servicedocument.png) 30 | 31 | 32 | ### 2. Create a new destination definition 33 | 34 | :point_right: Go to your "Trial Subaccount Home" page, and select the "Destinations" menu item within the "Connectivity" item. 35 | 36 | > You can define destinations at the subaccount level, or at the level of a destination service instance. We'll be defining our destination at the subaccount level in this Virtual Event. 37 | 38 | :point_right: Select the "New Destination" option, and in the configuration specify values for the appropriate parameters. Some values will depend on whether you have successfully completed the previous exercise and set up the SAP Cloud Connector or not, so the entire value set is presented twice, covering both scenarios. Use the values for your scenario. 39 | 40 | **With SAP Cloud Connector** 41 | 42 | If you have an SAP Cloud Connector set up and connected as described in the previous exercise, specify the following properties: 43 | 44 | | Property | Value | 45 | | ------------- | ----------------------- | 46 | | Name | shopinfo | 47 | | Type | HTTP | 48 | | Description | Virtual Event Shop Info | 49 | | URL | `http://virtuales5:8000/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/` | 50 | | Proxy Type | OnPremise | 51 | | Location ID | (leave blank) | 52 | | Authentication | BasicAuthentication | 53 | | User | (your ES5 username) | 54 | | Password | (your ES5 password) | 55 | 56 | 57 | **Without SAP Cloud Connector** 58 | 59 | If you were unable to set up an SAP Cloud Connector in the previous exercise, you should set up the destination to point directly to ES5. 60 | 61 | _Note: Remember, we're only "pretending" that the ES5 system is on-prem; it is, in fact, available directly on the public Internet._ 62 | 63 | | Property | Value | 64 | | ------------- | ----------------------- | 65 | | Name | shopinfo | 66 | | Type | HTTP | 67 | | Description | Virtual Event Shop Info | 68 | | Location ID | (leave blank) | 69 | | URL | `https://sapes5.sapdevcenter.com:443/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/` | 70 | | Proxy Type | Internet | 71 | | Authentication | BasicAuthentication | 72 | | User | (your ES5 username) | 73 | | Password | (your ES5 password) | 74 | 75 | 76 | **In Both Cases (Important!)** 77 | 78 | :point_right: In _both_ cases (whether you have an SAP Cloud Connector or not), add the following property / value pair in the "Additional Properties" section using the "New Property" button, and then save the entire destination definition with the "Save" button: 79 | 80 | | Property | Value | 81 | | ------------- | ----------------------- | 82 | | sap-client | 002 | 83 | 84 | 85 | ### 3. Deploy a simple app to test the destination connection 86 | 87 | At this stage you have the destination definition set up. But will everything work when everything is wired up, including from the workflow definition you'll define later? It's worth testing that new destination with a small app that just routes incoming requests via that destination to the data source (the OData service in ES5) using the Connectivity service. 88 | 89 | You will do that in this step, by deploying the simplest app definition (and its corresponding manifest file), and then testing the destination via that app's routing. While you would normally deploy applications from your editor or IDE, you can actually deploy an application archive, along with its corresponding descriptor file (the "manifest") manually from within the SAP Cloud Platform Cockpit. 90 | 91 | This simple app is basically the SAP [application router](https://blogs.sap.com/2019/06/13/sap-cloud-platform-backend-service-tutorial-24-understanding-app-router/) with configuration that tells it to route incoming requests to a target that's exposed via the destination that has been setup. For your reference, the entirety of this app and configuration is in the [dest-test-app/](dest-test-app/) directory, as follows: 92 | 93 | | File | Description | 94 | | ------------- | ------------------------- | 95 | | manifest.yml | the descriptor file describing how the application is to be deployed, and upon which services it relies | 96 | | package.json | the Node.js package description for the app, describing essentially what the app relies upon (the `@sap/approuter` package) and how to start it up | 97 | | xs-app.json | The approuter configuration, in the form of a single route that uses the `shopinfo` destination | 98 | 99 | The files `package.json` and `xs-app.json` have been bundled together into the archive file `app.zip` (also in the same `dest-test-app` directory). There's also an `xs-security.json` file which describes how the `xsuaa` service should be configured, a service upon which the app relies. 100 | 101 | :point_right: Download the [`app.zip`](dest-test-app/app.zip) and [`manifest.yml`](dest-test-app/manifest.yml) files. Download the `xsuaa` service parameter file [`xs-security.json`](dest-test-app/xs-security.json) file too. 102 | 103 | In fact, the successful operation of the app relies on not one but three services: 104 | 105 | - Authorization & Trust Management (`xsuaa`) 106 | - Connectivity (`connectivity`) 107 | - Destination (`destination`) 108 | 109 | You'll set up two of these (`xsuaa` and `destination`) manually, now, before deploying the app. 110 | 111 | :point_right: Navigate to the "dev" space in your Cloud Foundry (CF) organization, by first using the "Trial Subaccount Home" bookmark and then selecting the "dev" space from there. When you get there (it should default to showing you the Applications view in that space), create a second bookmark and call it "Dev Space Home". 112 | 113 | :point_right: From there, select the "Service Marketplace" menu item (within the "Services" item in the menu on the left hand side). From here you'll be setting up instances of these three services, using the same procedure each time: 114 | 115 | 1. Select the service from the Service Marketplace 116 | 1. From the service's Overview page that appears, select the "Instances" menu item 117 | 1. Use the "New Instance" button to create a new instance, and specify details for the steps in the resulting dialog each time, according to the following table 118 | 119 | |Service|Technical Name|Service Plan|Parameters|Assign Application|Instance Name| 120 | |-|-|-|-|-|-| 121 | |Authorization & Trust Management|`xsuaa`|`application`|Upload the `xs-security.json` file via the "Browse" button|(none)|`test-xsuaa`| 122 | |Destination|`destination`|`lite`|(none)|(none)|`test-destination`| 123 | 124 | > It's important that you use the instance names specified here, as they are referenced by name in the app's [`manifest.yml`](dest-test-app/manifest.yml) file. 125 | 126 | After doing this, you should have a couple of new service instances alongside your already existing instances; checking the "Service Instances" in your "Dev Space Home" should confirm this: 127 | 128 | ![service instances](serviceinstances.png) 129 | 130 | 131 | Now the service instances are in place, it's time to deploy the app itself. 132 | 133 | :point_right: Still in your "Dev Space Home", select the "Applications" menu item and use the "Deploy Application" button. For the "File Location", browse to and select the `app.zip` archive that you previously downloaded. Ensure that the "Use Manifest" checkbox is selected, then browse to and select the `manifest.yml` file that you also previously downloaded for the "Manifest Location". Then use the "Deploy" button. 134 | 135 | In a few moments, your app should be shown in the list as in the green "Started" state. 136 | 137 | :point_right: Select its name ("my-dest-test") and select the URL in the "Application Routes" section of the app's "Overview" page; the URL will contain a random string in the first part, to ensure that each of your apps deployed have unique hostnames: 138 | 139 | ![app route with random URL](approuteurl.png) 140 | 141 | After authenticating with your trial user email address and password, you'll be presented with the resource you saw at the start of this exercise. But this time, you're accessing it through the SAP Cloud Platform, via the Connectivity service and a destination definition, instead of directly. Moreover, if you've set up the Cloud Connector, this access is going through that too. Phewf! 142 | 143 | 144 | ### 4. Explore the Products entityset 145 | 146 | You'll be using data from the Products entityset in the OData service you've just exposed, so use this step to explore the data in that entityset, so you're at least a little bit familiar with it. 147 | 148 | :point_right: Append `Products` to the end of the existing URL, so it looks like this: 149 | 150 | ``` 151 | https://my-dest-test-.cfapps..hana.ondemand.com/Products 152 | ``` 153 | 154 | :point_right: Explore the data that is returned - you should see a list of products, with the sort of properties you'd expect from a product database, such as an ID, name, description, information about stock quantity, and so on. 155 | 156 | If you prefer looking at JSON rather than XML, append the query parameter `$format=json` to the URL, so that it looks like this: 157 | 158 | ``` 159 | https://my-dest-test-.cfapps..hana.ondemand.com/Products?$format=json 160 | ``` 161 | 162 | _Note: It's at this point you might want to take advantage of the [recommendations](../../prerequisites.md#recommendations) to install formatters for JSON and XML in Chrome._ 163 | 164 | Notice that there are products with IDs such as "HT-1001" and "HT-1002" representing computer hardware items such as laptops. We'll be referring to these in subsequent exercises. 165 | 166 | 167 | ## Summary 168 | 169 | You've now created a destination for use with the Connectivity service in the SAP Cloud Platform, and have successfully tested it, surfacing information from the remote ES5 system via a simple route mapping definition as part of an approuter-based app. 170 | 171 | You're now all set to be able to successfully consume the OData service at the endpoint you've defined in the destination from other services, in particular, the Workflow service. 172 | 173 | ## Questions 174 | 175 | 1. When you went to look at the OData service EPM_REF_APPS_SHOP_SRV for the first time at the start of this exercise, what was the resource that was returned? 176 | 177 | 178 | 2. What causes the random section of the URL to be generated? 179 | 180 | 181 | 3. What do you think the "Location ID" property is used for? How might we use it here, if we wanted to specify a value? 182 | 183 | -------------------------------------------------------------------------------- /exercises/04/servicedocument.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/04/servicedocument.png -------------------------------------------------------------------------------- /exercises/04/serviceinstances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/04/serviceinstances.png -------------------------------------------------------------------------------- /exercises/05/deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/05/deploy.png -------------------------------------------------------------------------------- /exercises/05/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 05 - Creating, deploying & instantiating a simple workflow 2 | 3 | In this exercise you'll create the simplest workflow definition possible, and deploy it to SAP Cloud Platform, whereupon you'll use the workflow related apps you set up in your Portal service powered Fiori launchpad (FLP) site to create an instance of the definition and look at it. 4 | 5 | ## Steps 6 | 7 | After completing these steps you'll understand the general flow of development, deployment and usage of workflows on SAP Cloud Platform, specifically in the Cloud Foundry (CF) environment. 8 | 9 | ### 1. Create a new Workflow project 10 | 11 | :point_right: Get back to your "App Studio Workflow Dev Space" by means of the same-named bookmark that you created in a previous exercise. 12 | 13 | > If you're just presented with a blank screen, this may be a sign that your Dev Space is in a STOPPED state. Remove the hashpath off the end of the URL (it will look something similar to this: `#ws-g86m2`) to get to your Dev Space overview where you can restart it. 14 | 15 | Previously, you created a project by dragging a directory into the Explorer space. This time, you'll use command line tools in the App Space's terminal facility. 16 | 17 | :point_right: Open up a terminal using menu path "Terminal -> New Terminal". You should be presented with a command line prompt, most likely showing the current location to be the `projects/` directory. 18 | 19 | If you're familiar with Unix shells, you'll feel right at home - don't forget, [#TheFutureIsTerminal](https://twitter.com/search?q=%23TheFutureIsTerminal&src=typed_query)! 20 | 21 | One of the command line tools available here and used to generate new projects is [Yeoman](https://yeoman.io). Let's use it now to generate a project within which we'll create a workflow definition. The project that we'll need to create looks conceptually like this: 22 | 23 | ``` 24 | +---------------------------------+ 25 | | Multi-target application | 26 | | | 27 | | +-----------------------------+ | 28 | | | Workflow module | | 29 | | | | | 30 | | | +-------------------------+ | | 31 | | | | Workflow definition | | | 32 | | | | | | | 33 | | | | | | | 34 | | | +-------------------------+ | | 35 | | | | | 36 | | +-----------------------------+ | 37 | | | 38 | +---------------------------------+ 39 | ``` 40 | 41 | In other words, the definition of the workflow itself lives within a module, which is part of a multi-target application (MTA). The build and deployment artifact is the top-level MTA. 42 | 43 | :point_right: At the command prompt, enter the command `yo` to invoke Yeoman. You should be presented with a menu similar to this: 44 | 45 | ![yo menu](yomenu.png) 46 | 47 | :point_right: Choose "**Basic Multitarget Application**" and make this specification: 48 | 49 | |Property|Value| 50 | |-|-| 51 | |Project name|OrderFlow| 52 | 53 | The Yeoman generator should complete pretty much immediately, and you should see that there's a new project directory `OrderFlow/` visible in the App Studio Explorer. 54 | 55 | :point_right: Still within the terminal, move into the new `OrderFlow/` directory with `cd OrderFlow/` and then invoke `yo` again, this time choosing the "**@workflow/workflow Module**", specifying the following: 56 | 57 | |Property|Value| 58 | |-|-| 59 | |Module name|OrderProcess| 60 | |Workflow name|orderprocess| 61 | |Workflow description|(leave blank)| 62 | 63 | > You may get a message about a conflict with `mta.yaml` - here you can safely enter "y" to have the contents updated. 64 | 65 | On completion, you should see a message similar to this: 66 | 67 | ``` 68 | create OrderProcess/workflows/orderprocess.workflow 69 | ``` 70 | 71 | > The names of the project, module and workflow definition are deliberately different here, to highlight that they're not the same thing. Note also, implied by the final message above, that you can have multiple workflow definitions in a single workflow module. 72 | 73 | You should end up with a very simple workflow definition, that looks like this: 74 | 75 | ![simple workflow definition](simpleworkflowdefinition.png) 76 | 77 | Observe that the workflow definition editor is graphical, and the file that represents the definition is within a `workflows/` directory within the project. 78 | 79 | In the last part of this step, we need to turn our attention to what's been added to the `mta.yaml` file as a result of adding this workflow module. 80 | 81 | :point_right: Open the OrderFlow project's `mta.yaml` file it in the editor and take a look - it should look something like this: 82 | 83 | ```yaml 84 | _schema-version: "3.2" 85 | ID: OrderFlow 86 | version: 0.0.1 87 | modules: 88 | - name: OrderProcess 89 | type: com.sap.application.content 90 | path: OrderProcess 91 | requires: 92 | - name: workflow_mta 93 | parameters: 94 | content-target: true 95 | resources: 96 | - name: workflow_mta 97 | parameters: 98 | service-plan: standard 99 | service: workflow 100 | type: org.cloudfoundry.managed-service 101 | 102 | ``` 103 | 104 | Take a moment to [stare](https://langram.org/2019/04/08/es6-reduce-and-pipe/) at this. You can see that there's a single module defined, with the name `OrderProcess`, which requires a Workflow service resource named `workflow_mta`, of type `org.cloudfoundry.managed-service`. The name of this required resource has been simply generated from the word "workflow" suffixed with "mta". 105 | 106 | But we already have a Workflow service instance called `default_workflow` which was created by the Workflow Management booster in an earlier exercise, so we need to adapt the references here in the `resources` section of the `mta.yaml` file, to reflect that. 107 | 108 | :point_right: First, modify the `type` of the resource defined, changing it from `org.cloudfoundry.managed-service` to `org.cloudfoundry.existing-service`, to reflect the fact that you already have a Workflow service instance. 109 | 110 | :point_right: Second, remove both the `service-plan` and `service` parameter properties (these are usually only needed when creating a new service instance), and add a new parameter property `service-name: default_workflow` to point to your existing Workflow service instance. 111 | 112 | The result should look like this: 113 | 114 | ```yaml 115 | _schema-version: "3.2" 116 | ID: OrderFlow 117 | version: 0.0.1 118 | modules: 119 | - name: OrderProcess 120 | type: com.sap.application.content 121 | path: OrderProcess 122 | requires: 123 | - name: workflow_mta 124 | parameters: 125 | content-target: true 126 | resources: 127 | - name: workflow_mta 128 | parameters: 129 | service-name: default_workflow 130 | type: org.cloudfoundry.existing-service 131 | ``` 132 | 133 | Don't forget to save your changes! 134 | 135 | 136 | ### 2. Build and deploy the project to the cloud 137 | 138 | While this workflow definition doesn't do very much, we can still carry out an initial exploration with the apps we made available in the Fiori launchpad in [Exercise 02](../02). So in this step we'll build and deploy the workflow definition to SAP Cloud Platform to be able to do that. 139 | 140 | :point_right: Use the context menu on the `mta.yaml` file in the App Studio Explorer (make sure it's the one in the `OrderFlow/` project directory) and choose "Build MTA". 141 | 142 | > If you prefer, you can stay in the terminal and build the MTA there by invoking `mbt build`. 143 | 144 | The build process thus triggered should complete in a few moments, and create a new directory `mta_archives/` within the project structure, containing an `.mtar` archive file ready to be deployed. 145 | 146 | :point_right: Deploy that file (it will most likely be called `OrderFlow_0.0.1.mtar`) using the context menu on the file name and choosing "Deploy MTA Archive", like this: 147 | 148 | ![deploying the MTA archive](deploy.png) 149 | 150 | > Again, if you prefer, you can stay in the terminal and deploy it from there, by invoking `cf deploy mta_archives/OrderFlow_0.0.1.mtar` (assuming here that you're still in the `OrderFlow/` directory). 151 | 152 | This deployment should also complete quite quickly. If you examine the contents of the `mta.yaml` file that you just edited, and also check the Applications and Service Instances sections of your "Dev Space Home" in the SAP Cloud Platform Cockpit, you'll see that this was a content deployment, rather than instantiation of any new CF service instances or applications. This makes sense, as it's a deployment of the workflow definition to the Workflow service instance. 153 | 154 | 155 | ### 3. Examine the workflow definition and create an instance of it 156 | 157 | :point_right: Go to your Fiori launchpad site and start the "Monitor Workflows - Workflow Definitions" app. You should see something like this: 158 | 159 | ![orderprocess workflow definition](workflowdefinitionv1.png) 160 | 161 | You can see that this is version 1 of the definition, the first version you've deployed (the version number is incremented automatically on each new deploy). 162 | 163 | Here you can start a new instance, which is what you should do now. Built in to the system is some simple test data that can be used to populate new instances of workflow definitions for testing purposes. You can, if you wish, modify or completely overwrite the test data. 164 | 165 | :point_right: Use the "Start New Instance" button, and in the dialog that appears, leave the test data as it is, and continue with the "Start New Instance" button to have an instance of your workflow definition created. A message should appear briefly to confirm that. 166 | 167 | ### 4. Look at the workflow instance 168 | 169 | :point_right: Switch to looking at the workflow instance you created, by using the "Show Instances" button. 170 | 171 | You should see a filtered display in the master list ... but it's likely that you won't see your newly created instance. This is because the default filter is to show instances with the following status values: 172 | 173 | - Erroneous 174 | - Running 175 | - Suspended 176 | 177 | Because of the simplicity of your workflow definition right now, the instance has already completed. 178 | 179 | :point_right: Use the filter icon at the bottom of the master list to add the status "Completed" to the status values. 180 | 181 | You should now see your instance. There's plenty of information to examine. 182 | 183 | :point_right: Take a couple of minutes to explore the information. 184 | 185 | ### 5. Create another workflow instance with different data 186 | 187 | Before finishing this exercise, it's worth going through the process of manually creating a workflow instance again, this time supplying different data. 188 | 189 | :point_right: Navigate back to the display of the workflow definition, and use the "Start New Instance" button again. This time, replace the entire test data (relating to the Hamlet book) with the following (which relates to product IDs in the OData service mentioned in the [Services section of the prerequisites](../../prerequisites.md#services)): 190 | 191 | ```json 192 | { 193 | "request": { 194 | "Id": "HT-1001", 195 | "Quantity": 5 196 | } 197 | } 198 | ``` 199 | 200 | Examining the completed instance this time, you should see this data in the Workflow Context section. 201 | 202 | ## Summary 203 | 204 | You've now gone through the process of bringing a workflow definition from your development environment (the SAP Business Application Studio) to the Workflow service on the SAP Cloud Platform, and using the administration apps to create and examine instances of it. You'll find that the "Monitor Workflows" app is a very useful tool. 205 | 206 | ## Questions 207 | 208 | 1. There are two tiles to look at workflow information - definitions and instances. Are there actually two apps? How did you jump from looking at your definition to looking at instances of it? What changed in the URL when you jumped? 209 | 210 | 1. What sort of information did you find when examining the completed workflow instance? Did you understand what everything was? What was in the workflow context, and what did you see when you selected "Show Tasks"? 211 | -------------------------------------------------------------------------------- /exercises/05/simpleworkflowdefinition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/05/simpleworkflowdefinition.png -------------------------------------------------------------------------------- /exercises/05/workflowdefinitionv1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/05/workflowdefinitionv1.png -------------------------------------------------------------------------------- /exercises/05/yomenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/05/yomenu.png -------------------------------------------------------------------------------- /exercises/06/environmentconfiguration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/environmentconfiguration.png -------------------------------------------------------------------------------- /exercises/06/envselected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/envselected.png -------------------------------------------------------------------------------- /exercises/06/errorresponse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/errorresponse.png -------------------------------------------------------------------------------- /exercises/06/get-workflow-definitions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/get-workflow-definitions.png -------------------------------------------------------------------------------- /exercises/06/instancedetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/instancedetails.png -------------------------------------------------------------------------------- /exercises/06/post-workflow-instances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/post-workflow-instances.png -------------------------------------------------------------------------------- /exercises/06/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 06 - Exploring the API Hub and the Workflow API 2 | 3 | In this exercise you'll take a look at the details of the Workflow service API in the SAP API Business Hub, and use the API to create an instance of your `orderprocess` definition, instead of doing it via the "Monitor Workflows" app. 4 | 5 | ## Steps 6 | 7 | After completing these steps you'll have set up an environment in the SAP API Business Hub that reflects the details of your trial account, and tried out a couple of API calls to start off a workflow via the API. 8 | 9 | ### 1. Log on to SAP API Business Hub 10 | 11 | :point_right: Go to the [SAP API Business Hub](https://api.sap.com/) and log on. 12 | 13 | This is the central place for discovery and consumption of APIs - see it as your "one stop shop" to learn about and try out APIs in the SAP universe. Take a few moments to look around and familiarize yourself with the site. 14 | 15 | ### 2. Find the Workflow API 16 | 17 | The Workflow API is of course documented and available for exploration here in the API Hub. 18 | 19 | :point_right: [Search for](https://api.sap.com/search?searchterm=workflow+API&tab=all) the Workflow API - you should find a number of results. The one we're interested in here is the [Workflow API for Cloud Foundry](https://api.sap.com/api/SAP_CP_Workflow_CF/resource). You should see something like this: 20 | 21 | ![Workflow API summary](workflowapisummary.png) 22 | 23 | It describes the different aspects that the API covers, such as: 24 | 25 | - User Task Instances 26 | - Workflow Definitions 27 | - Workflow Instances 28 | - Forms 29 | 30 | and so on. 31 | 32 | For each aspect there are a number of verb / noun combinations, in the form of HTTP methods (representing the verbs / and URL paths (representing the nouns). This verb / noun approach suggests that the Workflow API exhibits some qualities of the Representational State Transfer (REST) architectural style. 33 | 34 | :point_right: Explore each of the aspects, in particular "Workflow Instances". Try to identify which verb / noun combination in the "Workflow Instances" aspect would be appropriate to create a new instance of a workflow definition. 35 | 36 | 37 | ### 3. Configure an API Environment 38 | 39 | In the API Hub you can not only explore but also try out APIs. For this, there's a generic sandbox environment provided, but it's better and more convenient to set up an API environment that reflects your Cloud Foundry (CF) trial account setup. In this step you'll do just that, defining an API environment using credentials relating to the workflow service instance you've set up there. 40 | 41 | When you configure an environment, you need to supply endpoint and credential information, so the API Hub can facilitate making API calls for you. This information is available in the details of your workflow service instance, so you'll go there first to get that information, then return to the API Hub to specify it during the configuration. 42 | 43 | :point_right: Open up a new browser tab and go to your "Dev Space Home". Find the workflow service instance (use the "Service Instances" within "Services" in the left hand navigation) and select it, remembering that its name is `default_workflow`. 44 | 45 | :point_right: Now select the "Service Keys" navigation item which will reveal that there's a service key "OrderProcess-workflow_mta-credentials" that's been created for you. It should look something like this: 46 | 47 | ![service key details](servicekey.png) 48 | 49 | :point_right: Make a note of the following properties, the names of which reflect their "full paths" within the JSON structure: 50 | 51 | - `endpoints.workflow_rest_url` 52 | - `uaa.clientid` 53 | - `uaa.clientsecret` 54 | - `uaa.url` 55 | 56 | :point_right: Now switch back to the API Hub tab and select the "Configure Environments" link to get to a dialog where you can create a new environment. You should see something like this: 57 | 58 | ![environment configuration](environmentconfiguration.png) 59 | 60 | You should be defaulted to the "Create New Environment" mode. 61 | 62 | :point_right: Specify the following values, noting that the Starting URL selection should reflect the value of the `endpoints.workflow_rest_url` property, including the particular region: 63 | 64 | | Property | Value | 65 | | -------------- | ----------------------- | 66 | | Starting URL | the value of `endpoints.workflow_rest_url` | 67 | | Display Name for Environments | MyEnv | 68 | | OAuth 2.0 Client Id | the value of `uaa.clientid` | 69 | | OAuth 2.0 Secret | the value of `uaa.clientsecret` | 70 | | consumersubdomain | the most significant hostname part of the fully qualified domain name value of `uaa.url` | 71 | | landscapehost | the rest of the fully qualified domain name value of `uaa.url`, excluding the 'authentication' part | 72 | | Apply this environment to all APIs in this package that are not yet configured | _checked_ | 73 | | Save this environment for future sessions | _selected_ | 74 | 75 | Regarding the values for the properties "consumersubdomain" and "landscapehost", these are parts that contribute towards the generated value for "Token URL". Here's an example: 76 | 77 | - the value of `uaa.url` is `https://898789e9.authentication.eu10.hana.ondemand.com` 78 | - the value of "consumersubdomain" should be `898789e9trial` 79 | - the value of "landscapehost" should be `eu10.hana.ondemand.com` 80 | - the resulting "Token URL" should be `https://898789e9trial.authentication.eu10.hana.ondemand.com/oauth/token` 81 | 82 | Don't forget to save the settings when you're done. 83 | 84 | ### 4. Attempt to request workflow definition information via the API 85 | 86 | Now you can try out your new API environment by requesting information on the workflow definitions that you've already deployed to the Workflow service. If this is your first experience with the Workflow service, you should just see the single `orderprocess` definition in the results. 87 | 88 | :point_right: Select the "Workflow Definitions" aspect, and identify the verb / noun combination: 89 | 90 | ``` 91 | GET /v1/workflow-definitions 92 | ``` 93 | 94 | :point_right: Select your new API environment in the dropdown selection at the top of the verb / noun list, so that the "MyEnv" environment is shown as selected. 95 | 96 | ![MyEnv selected](envselected.png) 97 | 98 | :point_right: Use the "Try out" link to expand and explore the API call. You can leave all the parameters as they are, and use the "Execute" button to make the API call. 99 | 100 | An API call is made for you, with the credentials that you specified in the context of the environment that you defined. The results are shown, including the HTTP status code, the body of the response, and the response headers: 101 | 102 | ![403 error response](errorresponse.png) 103 | 104 | Wait, what? 105 | 106 | This is not what we were expecting, or at least not what we want. The HTTP status code is [403](https://en.wikipedia.org/wiki/HTTP_403), conveying the message that access to the requested resource (the `/v1/workflow-definitions` resource) is forbidden. Why is that? 107 | 108 | For many services, API usage is protected by scopes, also known as authorities. These scopes are relevant when using an authenticated connection in the context of an OData 2.0 client credentials grant type. In other words, authorities come into play (to "authorize" a call) when the authentication is connected directly to the instance. When an instance of a service is created, there may be some default scopes included, but it's always best to be explicit and specify the scopes that you'll require. 109 | 110 | If an instance is created as part of a larger process, like in the booster case in an earlier exercise, you can update the service instance and add the scopes manually. 111 | 112 | That's what we're going to do now. 113 | 114 | 115 | ### 5. Add the required scopes to the workflow service instance 116 | 117 | Updating a service instance can be done from the command line, using the `cf` command. You can use the terminal in your App Studio Workflow Dev Space. 118 | 119 | :point_right: Open up your App Studio Workflow Dev Space and get to a terminal prompt. You may have to use the menu path "Terminal -> New Terminal". 120 | 121 | :point_right: Depending on how long it's been since you last used the `cf` command in this virtual event, you may have to log in again. Check by issuing the `cf target` command, where you'll either get a message indicating you need to log in again, or you'll get some output showing you what endpoint you're connected to, including what organization and space. 122 | 123 | While we know that the name of the instance we want to update is `default_workflow`, it's good practice to double check. 124 | 125 | :point_right: List the instances with `cf s`; you should see some output that looks like this: 126 | 127 | ``` 128 | name service plan bound apps last operation broker upgrade available 129 | BPMServicesFLP_html5_repo_runtime html5-apps-repo app-runtime BPMServicesFLP_appRouter create succeeded sm-html5-apps-repo-sb-ebcb2b69-24a5-408e-be00-02066b302b78 130 | default_business-rules business-rules lite BPMFLP, BPMServicesFLP_appRouter create succeeded sm-businessrules-e73ec4d2-a715-4849-a5e9-77b521e7a086 131 | default_connectivity connectivity lite my-dest-test create succeeded sm-connectivity-a2f61383-be52-41a8-9cf0-f106e165151d 132 | default_portal portal standard BPMFLP, BPMServicesFLP_appRouter create succeeded sm-portal-fbae912e-4046-4304-90ad-b6d8ed1fa3be 133 | default_processvisibility processvisibility lite BPMFLP, BPMServicesFLP_appRouter create succeeded sm-processvisibility-dc3a0f83-9a80-4358-9c3e-f078de9f236e 134 | default_workflow workflow lite BPMFLP, BPMServicesFLP_appRouter update succeeded sm-workflow-broker-d2b48385-f83e-4601-9830-0db967aaa2f5 135 | test-destination destination lite my-dest-test create succeeded sm-destination-service-broker-40606adc-731d-484b-b585-feb9c1ec3fbb 136 | test-xsuaa xsuaa application my-dest-test create succeeded sm-xsuaa-9ef36350-f975-4194-a399-54db361e79b5 137 | uaa_bpmservices xsuaa application BPMFLP, BPMServicesFLP_appRouter create succeeded sm-xsuaa-9ef36350-f975-4194-a399-54db361e79b5 138 | ``` 139 | 140 | There it is, `default_workflow`, an instance of the `workflow` service using the `lite` plan. 141 | 142 | It's almost time to update the instance with the scopes we need. First, though, how do we know what they are? Looking closely back at the API endpoint information in the API Hub, we'll see what we're looking for. 143 | 144 | :point_right: Switch back to the API Hub and look at the details directly below the `GET /v1/workflow-definitions` API endpoint. They should look something like this: 145 | 146 | ![Details for 'GET /v1/workflow-definitions'](get-workflow-definitions.png) 147 | 148 | Relevant here is the line: 149 | 150 | ``` 151 | Scope: WORKFLOW_DEFINITION_GET 152 | ``` 153 | 154 | This is the scope that's needed to authorize a call to this endpoint. We're going to call another endpoint later in this exercise, so let's find out now what the scope required for that is, so we can add them both in the same instance update. 155 | 156 | :point_right: Select the "Workflow Instances" group on the left hand side and find `POST /v1/workflow-instances` in the HTTP verb / noun combinations. Expand it to reveal the details, which should look (in context) like this: 157 | 158 | ![Details for 'POST /v1/workflow-instances'](post-workflow-instances.png) 159 | 160 | In this case, the scope required to make such a call is shown as follows: 161 | 162 | ``` 163 | Scope: WORKFLOW_INSTANCE_START 164 | ``` 165 | 166 | Now we have the information we need to update the workflow service instance. 167 | 168 | In the terminal in your App Studio, use this to specify these two scopes for the `default_workflow` instance: 169 | 170 | ```shell 171 | cf update-service default_workflow -c '{"authorities": ["WORKFLOW_DEFINITION_GET", "WORKFLOW_INSTANCE_START"]}' 172 | ``` 173 | 174 | > The value supplied with the `-c` command option is in JSON format, make sure you use the right combination of quotes and brackets. Happily, as we're all using a Linux based Bash shell courtesy of the App Studio, there are no variations to worry about here! 175 | 176 | This update should complete with a simple "OK" message. 177 | 178 | If you want to confirm this, you can use the `cf curl` feature to request the retrieval of instance parameters, like this: 179 | 180 | ``` 181 | user: projects $ cf curl /v2/service_instances/$(cf service default_workflow --guid)/parameters 182 | { 183 | "authorities": [ 184 | "WORKFLOW_DEFINITION_GET", 185 | "WORKFLOW_INSTANCE_START" 186 | ] 187 | } 188 | ``` 189 | 190 | You can refer to the [Cloud Foundry Reference Guide for curl](https://cli.cloudfoundry.org/en-US/cf/curl.html) for more information. 191 | 192 | 193 | 194 | ### 6. Make another request for the workflow definition information 195 | 196 | Back in the API Hub you can now re-attempt the request you tried earlier in this exercise. 197 | 198 | :point_right: Find the `GET /v1/workflow-definitions` endpoint, make sure your environment "MyEnv" is selected, and use the "Try out" feature again. 199 | 200 | This time, the API call should complete successfully, you should receive an HTTP status code of 200, and a response body that looks like this: 201 | 202 | ```json 203 | [ 204 | { 205 | "id": "orderprocess", 206 | "version": "1", 207 | "name": "orderprocess", 208 | "createdBy": "sb-clone-60821b99-4ce8-43e9-a326-ce3a0fbad708!b51083|workflow!b10150", 209 | "createdAt": "2020-07-27T05:56:57.256Z", 210 | "jobs": [] 211 | } 212 | ] 213 | ``` 214 | 215 | Take a moment to stare at this output to understand it. And feel happy - you've just made your first successful API call, well done! 216 | 217 | 218 | ### 7. Create a new workflow instance via the API 219 | 220 | Now that you've tried out a read-only API call, it's time to use the API to create a new instance of your `orderprocess` workflow definition. 221 | 222 | :point_right: Select the "Workflow Instances" aspect and thence the `POST /v1/workflow-instances` verb / noun combination. Select the "Try out" link to be able to set up and execute the call. 223 | 224 | A payload is sent with this call, and you specify it in the "body" parameter here. 225 | 226 | :point_right: Specify the following for the value of the "body" parameter, being careful to get it exactly right, as it's JSON -- and quotes, colons and curly braces matter: 227 | 228 | ```json 229 | { 230 | "definitionId": "orderprocess", 231 | "context": { 232 | "request": { 233 | "Id": "HT-1002", 234 | "Quantity": 42 235 | } 236 | } 237 | } 238 | ``` 239 | 240 | _Note: It should be fairly evident what this is - it's the payload that is to be supplied to the workflow instance (very much like what we specified in the previous exercise), along with the workflow definition identifier._ 241 | 242 | :point_right: Use the "Execute" button to send the request. 243 | 244 | You should see a response with an HTTP status code of 201, and a response body & response headers that look like this: 245 | 246 | **Response body** 247 | 248 | ```json 249 | { 250 | "id": "b2b8f958-cbfe-11ea-a160-eeee0a8df42a", 251 | "definitionId": "orderprocess", 252 | "definitionVersion": "1", 253 | "subject": "orderprocess", 254 | "status": "RUNNING", 255 | "businessKey": "", 256 | "startedAt": "2020-07-22T09:35:36.882Z", 257 | "startedBy": "sb-clone-9a1a2e0e-d3f0-4bc6-92dd-cf1cda8495ba!b44074|workflow!b10150", 258 | "completedAt": null 259 | } 260 | ``` 261 | 262 | This call was possible because you included the WORKFLOW_INSTANCE_START scope in the instance update earlier. Great! 263 | 264 | 265 | ### 8. Check the newly created instance in the Fiori launchpad 266 | 267 | It is of course possible to use the "Workflow Monitor - Workflow Instances" to view this newly created instance. You can do that in this step. 268 | 269 | :point_right: Open up the "Workflow Monitor - Workflow Instances" app in your Fiori launchpad site. Don't forget to ensure that the filter is still allowing the display of instances in the "Completed" state. 270 | 271 | _Note: By the time you open the app, the instance will have completed, but it's nice to see the status immediately after creation, which was shown in the response body to the `POST /v1/workflow-instances` request. This status, as you can see above, was "RUNNING"._ 272 | 273 | :point_right: Examine the details for the instance, and try to match values up with what you saw from the results of the API call. You should be able to see that the values for the "Instance ID" and "Started At" properties, for example, are the same. 274 | 275 | _Note: Timezones play a part in dates and times, so the hour values may be offset - the time given in the API output is in UTC._ 276 | 277 | Here's an example of what you might see: 278 | 279 | ![instance details](instancedetails.png) 280 | 281 | 282 | ## Summary 283 | 284 | You've explored the Workflow API in the API Hub and successfully started a workflow instance via that API, supplying data that finds its way into the context of that instance. You've also managed to find evidence of that instance in the administration UI. Nice work! 285 | 286 | ## Questions 287 | 288 | 1. Why are there square brackets surrounding the response to the `GET /v1/workflow-definitions` API call? 289 | 290 | 1. In the payload of the `POST` call to `/v1/workflow-instances`, can you explain all aspects of the data contained therein? 291 | 292 | 1. What does HTTP response code 201 signify and how does it differ from 200? 293 | 294 | 1. Did you notice anything interesting about the instance created via the API, when compared to the ones you created via the Fiori monitor app? 295 | -------------------------------------------------------------------------------- /exercises/06/servicekey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/servicekey.png -------------------------------------------------------------------------------- /exercises/06/workflowapisummary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/06/workflowapisummary.png -------------------------------------------------------------------------------- /exercises/07/accesstoken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/accesstoken.png -------------------------------------------------------------------------------- /exercises/07/csrftokenreturned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/csrftokenreturned.png -------------------------------------------------------------------------------- /exercises/07/envdetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/envdetails.png -------------------------------------------------------------------------------- /exercises/07/envvarvals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/envvarvals.png -------------------------------------------------------------------------------- /exercises/07/import-collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/import-collection.png -------------------------------------------------------------------------------- /exercises/07/instancecreated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/instancecreated.png -------------------------------------------------------------------------------- /exercises/07/oauthtype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/oauthtype.png -------------------------------------------------------------------------------- /exercises/07/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 07 - Calling the Workflow API from Postman 2 | 3 | In the previous exercise you used the SAP API Business Hub to explore and use the Workflow API. With the confidence gained in those steps, it's now time to make similar calls, to create a new workflow instance, from a 3rd party API client - Postman. 4 | 5 | Postman is a very capable HTTP client with many features. In this exercise you'll use some of them, specifically environments and variables, and make use of the built-in support for OAuth 2.0. 6 | 7 | Using these features, you can achieve a semi-automated mechanism for creating new instances of your "orderprocess" workflow definition. 8 | 9 | ## Steps 10 | 11 | After completing these steps you'll know how to instantiate new workflows from Postman (and, by inference, from other API clients and tools). You'll also have a closer feel to what's going on behind the scenes in the SAP API Business Hub with respect to authentication. 12 | 13 | 14 | ### 1. Open Postman and import the Workflow Collection 15 | 16 | The API call you made in a previous exercise has been encapsulated into a small Postman collection that you can import and use. 17 | 18 | :point_right: Launch Postman and get ready to import a collection using the "Import From Link" feature in this dialog box that you get when you select the "Import" button at the top left of the Postman UI: 19 | 20 | ![import collection](import-collection.png) 21 | 22 | :point_right: In the dialog, specify the URL to this [workflowcollection.json](https://raw.githubusercontent.com/SAP-samples/cloud-platform-workflow-virtual-event/master/exercises/07/workflowcollection.json) resource, and use the "Import" button to complete the process. 23 | 24 | ### 2. Create a new Postman environment 25 | 26 | Postman offers the facility to manage collections of settings that pertain to different contexts, for example you might have a couple of development contexts and system endpoints, and a production context. These are called "environments" in Postman and in this step you will create one to store the details of your specific SAP Cloud Platform trial account context. 27 | 28 | Within environments you can use variables, and the environment-specific values for these are substituted at runtime. 29 | 30 | Environments are also separate by design from requests and collections, so that you can share the latter without compromising security by sharing values in the former. 31 | 32 | :point_right: Examine how these variables are used, by expanding the hierarchy of the "Workflow Collection" to reveal and select the POST request "Create new workflow instance", and looking at how the URL of that request is defined. 33 | 34 | You should see something like this: 35 | 36 | ![use of variable in URL](varinrequest.png) 37 | 38 | :point_right: Notice the use of the `{{endpoints.workflow_rest_url}}` variable in the URL, and the fact also that currently, indicated in the top right of the Postman UI, there is "No Environment" set. 39 | 40 | So at this point the request in its skeleton form is ready but you need to supply a value for the root of the URL, and also Postman needs to know how -- or more specifically with what credentials -- to request an OAuth token. It's a good idea to configure this in an environment, which is sort of the equivalent of the API Hub environment you configured in the previous exercise. 41 | 42 | :point_right: First, use the "Manage Environments" button (the cog) in the top right to open up a dialog where you can add an environment. In the form that appears, specify "My Workflow Environment" for the name. 43 | 44 | :point_right: Next, add each of the four properties from the service key data we came across in the previous exercise, as variables in this new environment: 45 | 46 | - `endpoints.workflow_rest_url` 47 | - `uaa.clientid` 48 | - `uaa.clientsecret` 49 | - `uaa.url` 50 | 51 | You should end up with something like this: 52 | 53 | ![environment variables and values](envvarvals.png) 54 | 55 | > The property names in Postman environments are arbitrary, but it makes sense to use names that mean something to us. 56 | 57 | 58 | ### 3. Select the new environment for use 59 | 60 | Once you've finished adding this new environment, you should select it for use. 61 | 62 | :point_right: Select the new environment from the drop-down selection that you saw earlier (it was set to "No Environment" at that time). Then notice that the `{{endpoints.workflow_rest_url}}` variable in the request URL has turned from red, indicating the variable wasn't defined, to a slightly more orange color, and when you hover over it the value is displayed: 63 | 64 | ![value of workflowapi variable](workflowapivalue.png) 65 | 66 | 67 | ### 4. Set up authentication for the request 68 | 69 | The Cloud Foundry (CF) Workflow APIs are protected with OAuth 2.0, and the API Hub handles that for us, specifically using the "Client Credentials" flow. In order to make the call in Postman, using the same authentication approach, we need to take the variable values we specified in our environment and use them in Postman's OAuth 2.0 configuration for retrieving an access token, which is what's requested and used in such a flow. 70 | 71 | :point_right: Switch to the "Authorization" tab of the request and, for the type, ensure that "OAuth 2.0" is selected. This should give you the possibility of setting things up for requesting and using OAuth 2.0 access tokens as employed in the OAuth flow we want to use: 72 | 73 | ![OAuth 2.0 authorization type settings](oauthtype.png) 74 | 75 | :point_right: Now use the "Get New Access Token" button to specify details for, and request, an access token. In the dialog box that appears, give a name such as "MyToken", select "Client Credentials" for the grant type, "Send as Basic Auth header" for the client authentication, and specify the values for "Access Token URL", "Client ID" and "Client Secret" using the environment variables you defined earlier. Make sure to add `/oauth/token` as a suffix to the access token URL: 76 | 77 | ![request token](requesttoken.png) 78 | 79 | > You may see encoding warnings for the values in the Client ID and Client Secret fields - we can ignore those for the purposes of what we're doing here. 80 | 81 | :point_right: Use the "Request Token" button which will make the OAuth 2.0 call to request an access token, which, if all goes well, will be shown to you and subsequently be available via the "MyToken" name you gave it. 82 | 83 | > If you're curious to see what actually happened in this request, you can use Postman's console (View -> Show Postman Console) to inspect the HTTP traffic for this access token request call. 84 | 85 | :point_right: Now you need to tell Postman to use this token. Either select the "Use Token" button that's available in the current token dialog, or -- after closing this dialog to get back to the Authorization tab -- or select the token using the "Available Tokens" selection, so that the "Access Token" parameter is filled in, something like this: 86 | 87 | ![access token](accesstoken.png) 88 | 89 | 90 | ### 5. Examine the rest of the request's details 91 | 92 | In this step you'll take a final look at the request before submitting it. 93 | 94 | :point_right: Switch to the Headers tab now, where you should see an Authorization header with the access token as the value, preceded with the word "Bearer". This is Postman using the access token (that you retrieved just before) to authenticate the actual API call. 95 | 96 | :point_right: Now look at the "Body" tab and you should see something that looks familiar - a request body similar to the one you specified in Exercise 06 when you [created a new workflow instance](../06/readme.md#5-create-a-new-workflow-instance-via-the-api): 97 | 98 | ```json 99 | { 100 | "definitionId" : "orderprocess", 101 | "context": { 102 | "request": { 103 | "Id": "HT-1003", 104 | "Quantity": 25 105 | } 106 | } 107 | } 108 | ``` 109 | 110 | ### 6. Make the request 111 | 112 | Now it's finally time to send the request to create a new workflow instance. 113 | 114 | :point_right: Send the request with the "Send" button and examine the response. 115 | 116 | If all goes well, you should see something in the response body - similar to what you saw in the response body in the previous exercise when you created a new workflow instance. Note too that the HTTP status code is, as expected, 201. 117 | 118 | ![instance created](instancecreated.png) 119 | 120 | Great! This is only a very short step, but an important one - it shows that you've set everything up correctly to authenticate with OAuth "Client Credentials" flow. 121 | 122 | 123 | ### 7. Check the new instance in the Fiori launchpad 124 | 125 | As a final step in this exercise, you should check the newly created instance in your Fiori launchpad. 126 | 127 | :point_right: Open up your Fiori launchpad and select the "Monitor Workflows - Workflow Instances" app. Make sure that the filter in the master list includes the status "Completed". You should see the instance you have created via Postman - you can identify it by the fact that product with ID "HT-1003" (rather than "HT-1002" or "HT-1001") has been requested. 128 | 129 | Nice work! 130 | 131 | ## Summary 132 | 133 | You've now got a Postman environment set up, with a simple request that can be conveniently run to create new workflow instances. Moreover, you have a better feel for how these requests are authenticated. 134 | 135 | ## Questions 136 | 137 | 1. What's the difference between the "Initial Value" and "Current Value" columns in environment variable definitions? 138 | 139 | 1. What other HTTP client tools might you have in mind to use instead of (or in addition to) Postman? 140 | 141 | 1. How often do you think you'll need to fetch a new access token? 142 | -------------------------------------------------------------------------------- /exercises/07/requesttoken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/requesttoken.png -------------------------------------------------------------------------------- /exercises/07/varinrequest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/varinrequest.png -------------------------------------------------------------------------------- /exercises/07/workflowapivalue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/07/workflowapivalue.png -------------------------------------------------------------------------------- /exercises/07/workflowcollection.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "06807570-ba1c-499f-9fc9-098091bee7a9", 4 | "name": "Workflow Collection", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 6 | }, 7 | "item": [ 8 | { 9 | "name": "Create new \"orderprocess\" workflow instance", 10 | "item": [ 11 | { 12 | "name": "Create new workflow instance", 13 | "request": { 14 | "auth": { 15 | "type": "oauth2", 16 | "oauth2": [ 17 | { 18 | "key": "accessToken", 19 | "value": "", 20 | "type": "string" 21 | }, 22 | { 23 | "key": "tokenType", 24 | "value": "bearer", 25 | "type": "string" 26 | }, 27 | { 28 | "key": "addTokenTo", 29 | "value": "header", 30 | "type": "string" 31 | } 32 | ] 33 | }, 34 | "method": "POST", 35 | "header": [ 36 | { 37 | "key": "Content-Type", 38 | "value": "application/json" 39 | } 40 | ], 41 | "body": { 42 | "mode": "raw", 43 | "raw": "{\n \"definitionId\": \"orderprocess\",\n \"context\": {\n \"request\": {\n \"Id\": \"HT-1003\",\n \"Quantity\": 25\n }\n }\n}" 44 | }, 45 | "url": { 46 | "raw": "{{endpoints.workflow_rest_url}}/v1/workflow-instances", 47 | "host": [ 48 | "{{endpoints.workflow_rest_url}}" 49 | ], 50 | "path": [ 51 | "v1", 52 | "workflow-instances" 53 | ] 54 | } 55 | }, 56 | "response": [] 57 | } 58 | ], 59 | "description": "Create a new instance of the \"orderprocess\" workflow.", 60 | "event": [ 61 | { 62 | "listen": "prerequest", 63 | "script": { 64 | "id": "1ea9cf90-d012-460e-bae4-f2fd298f040c", 65 | "type": "text/javascript", 66 | "exec": [ 67 | "" 68 | ] 69 | } 70 | }, 71 | { 72 | "listen": "test", 73 | "script": { 74 | "id": "15584ec1-5cec-441e-8f70-fe2e626e6667", 75 | "type": "text/javascript", 76 | "exec": [ 77 | "" 78 | ] 79 | } 80 | } 81 | ], 82 | "protocolProfileBehavior": {} 83 | } 84 | ], 85 | "protocolProfileBehavior": {} 86 | } 87 | -------------------------------------------------------------------------------- /exercises/08/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 08 - Adding a Service Task to the workflow definition 2 | 3 | In this exercise you'll go back to the workflow definition you created in a previous exercise and add a Service Task to it to retrieve product information for the product ID specified when workflow instances are created. 4 | 5 | ## Steps 6 | 7 | After completing these steps you'll have a workflow definition with a service task configured, and have deployed and tested it. 8 | 9 | ### 1. Open up the workflow definition in the IDE 10 | 11 | :point_right: Open up your App Studio Workflow Dev Space via the bookmark you saved in a previous exercise. 12 | 13 | > If you get an empty page, it's because the Dev Space is in a "STOPPED" state; remove the hashpath from the end of the URL to get back to the Dev Space overview so you can restart the Dev Space and jump back in. 14 | 15 | :point_right: Once you're in, open the `orderprocess.workflow` workflow definition that should currently sport only a start event and an end event. 16 | 17 | ### 2. Add a Service Task 18 | 19 | :point_right: Use the Tasks menu in the graphical workflow editor to add a Service Task, and place it between the start event and the end event. 20 | 21 | ![Service Task selection](servicetaskselection.png) 22 | 23 | It should look like this once you've added it: 24 | 25 | ![Service Task added](servicetaskadded.png) 26 | 27 | You may notice a warning triangle decorating the Service Task in your workflow - this signifies that there is some configuration still needed. 28 | 29 | :point_right: While the Service Task is selected, go to the "Details" tab of the "Service Task Properties" on the right hand side, and specify the following values: 30 | 31 | | Property | Value | 32 | | -------------- | ------------------ | 33 | | Destination | `shopinfo` | 34 | | Choose a Service from | (leave as "Others") | 35 | | Path | `Products('${context.request.Id}')?sap-client=002` | 36 | | HTTP Method | GET | 37 | | Response Variable | `${context.productInfo}` | 38 | | Principal Propagation | (leave unchecked) | 39 | 40 | > The "shopinfo" value is the name of the destination you created in [Exercise 04](../04). 41 | 42 | > The "sap-client=002" query parameter is needed here in the "Path" despite the additional property setting in the destination definition as currently the Workflow service does not support that property. 43 | 44 | :point_right: Ensure your changes are saved. 45 | 46 | 47 | ### 3. Deploy the workflow definition 48 | 49 | Now it's time to redeploy the definition to the Workflow service, so that this addition of a Service Task is live. This is done following a similar build-deploy procedure to what you've used already, in [Exercise 05](../05). But instead of using the context menu and selecting the tasks from a menu, this time you're going to do it in the terminal. 50 | 51 | :point_right: First, make sure you've got a terminal ready and available within your App Studio Workflow Dev Space (if you haven't, open one with the menu path "Terminal -> New Terminal") and that you're in the `OrderFlow/` project directory (if you're in the parent `projects/` directory, use `cd OrderFlow/`). 52 | 53 | First, the deployable archive must be built. In the terminal, this is done by invoking the Cloud MTA Build Tool (MBT) from the command line, like this: 54 | 55 | ``` 56 | mbt build 57 | ``` 58 | 59 | Like before, the process should complete fairly quickly, and you'll see output that looks similar to the output you got when you invoked the build step via the context menu. This is because it is - the same tool (MBT) is used in both cases. 60 | 61 | The output should look something like this: 62 | 63 | ``` 64 | [2020-07-22 10:30:28] INFO Cloud MTA Build Tool version 1.0.15 65 | [2020-07-22 10:30:28] INFO generating the "Makefile_20200722103028.mta" file... 66 | [2020-07-22 10:30:28] INFO done 67 | [2020-07-22 10:30:28] INFO executing the "make -f Makefile_20200722103028.mta p=cf mtar= strict=true mode=" command... 68 | [2020-07-22 10:30:28] INFO validating the MTA project 69 | [2020-07-22 10:30:28] INFO validating the MTA project 70 | [2020-07-22 10:30:28] INFO building the "OrderProcess" module... 71 | [2020-07-22 10:30:28] INFO the build results of the "OrderProcess" module will be packaged and saved in the "/home/user/projects/OrderFlow/.OrderFlow_mta_build_tmp/OrderProcess" folder 72 | [2020-07-22 10:30:28] INFO finished building the "OrderProcess" module 73 | [2020-07-22 10:30:28] INFO generating the metadata... 74 | [2020-07-22 10:30:28] INFO generating the "/home/user/projects/OrderFlow/.OrderFlow_mta_build_tmp/META-INF/mtad.yaml" file... 75 | [2020-07-22 10:30:28] INFO generating the MTA archive... 76 | [2020-07-22 10:30:28] INFO the MTA archive generated at: /home/user/projects/OrderFlow/mta_archives/OrderFlow_0.0.1.mtar 77 | [2020-07-22 10:30:28] INFO cleaning temporary files... 78 | ``` 79 | 80 | As indicated in the output, there's a freshly generated `OrderFlow_0.0.1.mtar` file in the `mta_archives/` directory. So now it's time to deploy it. Again, from within the terminal. 81 | 82 | :point_right: In the terminal, deploy the archive like this: 83 | 84 | ``` 85 | cf deploy mta_archives/OrderFlow_0.0.1.mtar 86 | ``` 87 | 88 | > You may have to re-authenticate with the CF endpoint, using `cf login`. 89 | 90 | Again, the output is given to you directly in the terminal, and will look something like this: 91 | 92 | ``` 93 | Deploying multi-target app archive mta_archives/OrderFlow_0.0.1.mtar in org 898789e9trial / space dev as dj.adams@sap.com... 94 | 95 | Uploading 1 files... 96 | /home/user/projects/OrderFlow/mta_archives/OrderFlow_0.0.1.mtar 97 | OK 98 | Operation ID: f9c57a48-cc06-11ea-a023-eeee0a846b5b 99 | Deploying in org "898789e9trial" and space "dev" 100 | Detected MTA schema version: "3" 101 | No deployed MTA detected - this is initial deployment 102 | Detected new MTA version: "0.0.1" 103 | Service key "OrderProcess-workflow_mta-credentials" for service "default_workflow" already exists 104 | Uploading content module "OrderProcess" in target service "workflow_mta"... 105 | Deploying content module "OrderProcess" in target service "workflow_mta"... 106 | Skipping deletion of services, because the command line option "--delete-services" is not specified. 107 | Process finished. 108 | Use "cf dmol -i f9c57a48-cc06-11ea-a023-eeee0a846b5b" to download the logs of the process. 109 | ``` 110 | 111 | > If you're curious to see some sort of acknowledgement that something has been updated, you can switch to the "Monitor Workflow - Workflow Definitions" Fiori app on your Fiori launchpad, and check that the version number for your "orderprocess" workflow definition has been incremented. 112 | 113 | 114 | ### 4. Create a new instance of the workflow definition 115 | 116 | Now we have the Service Task in the workflow definition, let's try it out. 117 | 118 | :point_right: Switch back over to Postman and send another "Create new workflow instance" request (with the blue "Send" button). This should result in another successful 201 status code, showing the details of the freshly minted workflow instance. 119 | 120 | :point_right: Now start the "Monitor Workflows - Workflow Instances" app in your Fiori launchpad site, ensuring that the filter is set to show instances in "Completed" status. Find the instance that's just been created, and examine the Workflow Context, which should look something like this: 121 | 122 | ```json 123 | { 124 | "request": { 125 | "Id": "HT-1003", 126 | "Quantity": 25 127 | }, 128 | "productInfo": { 129 | "d": { 130 | "__metadata": { 131 | "id": "https://virtuales5:8000/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/Products('HT-1003')", 132 | "uri": "https://virtuales5:8000/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/Products('HT-1003')", 133 | "type": "EPM_REF_APPS_SHOP.Product" 134 | }, 135 | "AverageRating": "3.11", 136 | "Name": "Notebook Basic 19", 137 | "Description": "Notebook Basic 19 with 2,80 GHz quad core, 19\" LCD, 8 GB DDR3 RAM, 1000 GB Hard Disc, Windows 8 Pro", 138 | "StockQuantity": 150, 139 | "CurrencyCode": "USD", 140 | "DimensionDepth": "21", 141 | "DimensionHeight": "4", 142 | "DimensionUnit": "cm", 143 | "DimensionWidth": "32", 144 | "HasReviewOfCurrentUser": false, 145 | "Id": "HT-1003", 146 | "ImageUrl": "/sap/public/bc/NWDEMO_MODEL/IMAGES/HT-1003.jpg", 147 | "IsFavoriteOfCurrentUser": false, 148 | "LastModified": "/Date(1595383327000)/", 149 | "MainCategoryId": "Computer Systems", 150 | "MainCategoryName": "Computer Systems", 151 | "MeasureUnit": "each", 152 | "Price": "1650.00", 153 | "QuantityUnit": "EA", 154 | "RatingCount": 9, 155 | "SubCategoryId": "Notebooks", 156 | "SubCategoryName": "Notebooks", 157 | "SupplierId": "100000003", 158 | "SupplierName": "Talpa", 159 | "WeightMeasure": "4.2" 160 | } 161 | } 162 | } 163 | ``` 164 | 165 | > Some of the properties have been omitted to keep the display concise. 166 | 167 | Notice that the context now contains extra data, in the `productInfo` property. This is what was retrieved in the Service Task. 168 | 169 | ## Summary 170 | 171 | You now have a workflow definition that includes a task that fetches data from a remote service, in particular, the service available in the on-prem ABAP stack SAP system that you made available via the SAP Cloud Connector. 172 | 173 | ## Questions 174 | 175 | 1. When you switched from HTTP Method POST to GET when setting the Service Task properties, the "Path to XSRF Token" property disappeared. Why was that? 176 | 177 | 1. How does the product data from the OData service end up where it does in the workflow instance context? 178 | 179 | 1. When we request an entity from an OData service in the browser, such as the [Chai product from the Northwind dataset](https://services.odata.org/V3/Northwind/Northwind.svc/Products(1)), we usually see it in an XML representation, and have to add a query parameter `$format=json` to the URL, like this: [https://services.odata.org/V3/Northwind/Northwind.svc/Products(1)?$format=json](https://services.odata.org/V3/Northwind/Northwind.svc/Products(1)?$format=json). Why do you think we received a JSON representation even when we didn't use this query parameter in the Service Task settings? 180 | -------------------------------------------------------------------------------- /exercises/08/servicetaskadded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/08/servicetaskadded.png -------------------------------------------------------------------------------- /exercises/08/servicetaskselection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/08/servicetaskselection.png -------------------------------------------------------------------------------- /exercises/09/arrangementbuttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/arrangementbuttons.png -------------------------------------------------------------------------------- /exercises/09/formdecisions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/formdecisions.png -------------------------------------------------------------------------------- /exercises/09/formfields.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/formfields.png -------------------------------------------------------------------------------- /exercises/09/myinboxitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/myinboxitem.png -------------------------------------------------------------------------------- /exercises/09/newformdialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/newformdialog.png -------------------------------------------------------------------------------- /exercises/09/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 09 - Adding a User Task to the workflow definition 2 | 3 | In this exercise you'll enhance the workflow definition by adding a User Task to it, so that a decision point can be presented to a person in the My Inbox app. 4 | 5 | ## Steps 6 | 7 | After completing these steps you'll have a User Task in your workflow definition that presents information from the workflow instance context, and asks for a decision. 8 | 9 | 10 | ### 1. Open up the workflow definition 11 | 12 | :point_right: Switch back to your App Studio Workflow Dev Space session, and open the `orderprocess.workflow` workflow definition that should show your definition with the Service Task between the start and end events. 13 | 14 | 15 | ### 2. Add a User Task to the definition 16 | 17 | :point_right: In a similar way to how you added a Service Task in [the previous exercise](../08/), use the Tasks menu in the graphical workflow editor to add a User Task, and place it after the Service Task, and before the end event. 18 | 19 | > You can make use of the "Arrange Vertically" and "Arrange Horizontally" buttons in the editor to tidy up the graphical flow after adding items to the definition. 20 | 21 | ![arrangement buttons](arrangementbuttons.png) 22 | 23 | The User Task requires certain settings. First though, let's change the name of the User Task, as well as the Service Task, so they are more meaningful in the editor. 24 | 25 | :point_right: Select the User Task and in the "General" tab of the "User Task Properties" on the right hand side, specify the value "Approval Decision". Then select the Service Task and make a similar change, changing the current value of "ServiceTask1" to "Retrieve Product Info". Don't forget to save. 26 | 27 | Now it's time to specify the User Task settings. 28 | 29 | :point_right: In the "Details" tab of the "User Task Properties", specify the following values, not forgetting to save: 30 | 31 | | Property | Value | 32 | | ------------ | -------------- | 33 | | Priority | (keep at "Medium" or change if you wish) | 34 | | Subject | `Request for ${context.productInfo.d.Name}` | 35 | | Description | `Please review this request for ${context.request.Quantity} items.` | 36 | | Users | \ | 37 | | Group | (leave blank) | 38 | | Configure Due Date | (leave unchecked) | 39 | 40 | > Within the context of the trial account you are using (with only a single user - you - available), it makes sense to specify yourself as a recipient of the user task items. In other situations this could be a calculated value, or the "Group" property could be used instead. 41 | 42 | 43 | ### 3. Create a new workflow instance and check the User Task 44 | 45 | Even though you've only configured the minimum, you can still see the raw results of your work. You'll have to specify dummy values for a couple more properties, but then you can save the workflow definition, redeploy it, create a new instance and have a look at what happens. 46 | 47 | :point_right: In the "User Interface" tab of the "User Task Properties", the properties "HTML5 App Name" and "SAPUI5 Component" are required. These relate to the default "Type" that is pre-selected ("SAPUI5 Component"). Specify the dummy value "x" for each of them. 48 | 49 | > This is the place where you'd normally specify details of a custom UI5 component that is to be used to represent the details of the user task in the My Inbox app. Building a custom UI5 component for this is beyond the scope of these exercises, but we can take advantage of the settings required by providing dummy values for both the properties. The result will be the ability to deploy the modified workflow definition (because the validity of the component details is only an issue at runtime), and a half-empty but understandable user task entry in the My Inbox app, which will be fine for us for now. 50 | 51 | ![user interface details](uidetails.png) 52 | 53 | :point_right: Save the workflow definition, and then follow the same "build/deploy" process you used in previous exercises - either the context menu approach, or the terminal-based approach. Your choice :-) 54 | 55 | > If you opt for the terminal-based approach, you can use the power of the Unix shell and combine commands, such that the `cf deploy` will run automatically, but only if the `mbt build` completes successfully: `mbt build && cf deploy mta_archives/OrderFlow_0.0.1.mtar`. See [Conditional execution](https://en.wikipedia.org/wiki/Bash_(Unix_shell)#Conditional_execution) if you want to learn more. 56 | 57 | :point_right: Now create a new instance using Postman, as you have [done before in Exercise 08](../08#4-create-a-new-instance-of-the-workflow-definition). 58 | 59 | :point_right: Switch to your Fiori launchpad site, and you should now see that there is a task waiting for you in the My Inbox app: 60 | 61 | ![task in My Inbox](taskinmyinbox.png) 62 | 63 | :point_right: Go ahead and select the My Inbox tile, to view the item. It should look something like this: 64 | 65 | ![My Inbox item](myinboxitem.png) 66 | 67 | You should see that the user task is there, with the correct name ("Approval Decision"), subject ("Request for ...") and description ("Please review this request ..."). But there is not much else, and no action buttons for you to select to mark your decision. 68 | 69 | > The "Show Log" and "Claim" buttons are not decision related, they are generic features available in all user tasks. 70 | 71 | Because this is only a half-baked user task, you won't be able to complete it here, you'll have to terminate the instance as an administrator, in the "Monitor Workflow - Workflow Instances" app. 72 | 73 | :point_right: Switch to the "Monitor Workflow - Workflow Instances" app and find the instance of the "orderprocess" definition that relates to this user task. You should be able to find it quite easily, as it will still be in the status "Running": 74 | 75 | ![running instance](runninginstance.png) 76 | 77 | :point_right: Select the "Execution Log" and have a look at what's been happening - you should be able to see the step by step progress of this workflow instance, from start, through the Service Task, to the User Task becoming available. 78 | 79 | :point_right: To keep things clean and tidy, it's worth removing this from the default filtered list of instances, so use the "Terminate" button to end the instance. It should disappear from the list. 80 | 81 | ### 4. Add a Form to the User Task in the workflow definition 82 | 83 | You can build custom UI5 components to be used within the My Inbox app to display user task information and offer user interaction, or you can use a zero-code form builder facility within the workflow editor to create a form that can display and collect data, and offer decision buttons. 84 | 85 | For the majority of simple decision tasks, a form is likely to be a good choice as they're easy and fast to create and don't require programming knowledge. 86 | 87 | In this step you'll add a form to be used in the User Task you created earlier in this exercise. 88 | 89 | :point_right: Go back to editing the workflow definition in the App Studio Workflow Dev Space and select the User Task. In the "User Interface" tab of the "User Task Properties", switch from type "SAPUI5 Component" to "Form", and then select the "Create File" link to open up a dialog where you can specify the basic form information: 90 | 91 | ![New Form dialog](newformdialog.png) 92 | 93 | :point_right: Specify the following property values before selecting the "Create" button: 94 | 95 | | Property | Value | 96 | | ------------ | ----------------- | 97 | | Name | `RequestDecision` | 98 | | ID | `requestdecision` | 99 | | Revision | `1` | 100 | | Type | (leave as "Task Form") | 101 | 102 | > This form will be created as a file inside your workflow project directory structure, specifically within the `forms/` directory. 103 | 104 | At this point you're presented with a simple form designer, which will allow you to create a form with sections, read-only fields, input fields and decision buttons. 105 | 106 | :point_right: Create a series of sections and fields as shown in the screenshot below, taking care to specify the context path values exactly (pay attention to upper/lower case details). For all fields except for the "Your comments" field, use the field properties on the right hand side to set the "Mode" to "Display-Only". 107 | 108 | ![form fields](formfields.png) 109 | 110 | > Notice that the letter "I"s in the above context paths are capitalized, i.e. `productInfo` and `Id`. 111 | 112 | :point_right: In the properties for the "Your comments" field, specify "Text Area" for the "UI Control" property (to produce a space large enough for input when the field is rendered). 113 | 114 | :point_right: Switch to the "Decisions" tab and add two decision rows as shown: 115 | 116 | ![form decisions](formdecisions.png) 117 | 118 | 119 | :point_right: Ensure everything is saved, and follow the same "build/deploy" flow as before to get these changes and additions to the workflow definition into your instance of the Workflow service. 120 | 121 | 122 | ### 5. Try the Form out 123 | 124 | It's time to try out the form that you've just created. 125 | 126 | :point_right: As you did [earlier in this exercise](#3-create-a-new-workflow-instance-and-check-the-user-task), create a new workflow instance using Postman. 127 | 128 | :point_right: Next, go to the My Inbox app in your Fiori launchpad site, and there should be a user task waiting for you. This time, unlike the previous user task, you can see the detail, because of the form. This is what it should look like: 129 | 130 | ![user task displayed with form](usertaskform.png) 131 | 132 | Notice the read-only and editable fields, and also the buttons at the bottom representing the decisions you defined. 133 | 134 | :point_right: Enter a comment in the input box provided, and approve or reject the task, causing it to move to the completed status and be removed from view. 135 | 136 | ## Summary 137 | 138 | You now have a user task in your simple workflow definition, and have used a form to present information to the user to allow them to make a decision and also (via the comment field) add some data to the context. 139 | 140 | ## Questions 141 | 142 | 1. When looking at the "Execution Log" details of the first instance you created with a User Task, there was an "Instance ID" link. What did that lead you to, and what does it represent? 143 | 144 | 1. When you terminated the instance in Step 3, what status did it end up in? 145 | 146 | 1. Where are the comments stored when the task is completed? 147 | -------------------------------------------------------------------------------- /exercises/09/runninginstance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/runninginstance.png -------------------------------------------------------------------------------- /exercises/09/taskinmyinbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/taskinmyinbox.png -------------------------------------------------------------------------------- /exercises/09/uidetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/uidetails.png -------------------------------------------------------------------------------- /exercises/09/usertaskform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/09/usertaskform.png -------------------------------------------------------------------------------- /exercises/10/addscripttask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/10/addscripttask.png -------------------------------------------------------------------------------- /exercises/10/commentsincontext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/10/commentsincontext.png -------------------------------------------------------------------------------- /exercises/10/readme.md: -------------------------------------------------------------------------------- 1 | # Exercise 10 - Accessing contextual information in a Script Task 2 | 3 | In this exercise you'll add a Script Task to your workflow definition and explore some of the context information available to you in a running workflow instance. 4 | 5 | ## Steps 6 | 7 | After completing these steps you'll have a third task in your workflow definition, and understand how to access contextual information during Script Task execution. 8 | 9 | ### 1. Review result of User Task activity 10 | 11 | In the [last step of the previous exercise](../09#5-try-the-form-out) you entered a comment and selected either the "Approve" or the "Reject" button to complete the task (and thus the workflow instance). In this step you'll check the result of this activity to see what information is available directly in the context via the "Monitor Workflows - Workflow Instances" app. 12 | 13 | :point_right: In your Fiori launchpad site, open the "Monitor Workflows - Workflow Instances" app and find the most recent instance (you may have to readjust the filter to show instances in "Completed" status). 14 | 15 | :point_right: Look at the Workflow Context of this instance, and check for the comments you entered when processing the task. You should see something like this: 16 | 17 | ![comments in workflow context](commentsincontext.png) 18 | 19 | :point_right: Check elsewhere in the context to find what decision was made - approval or rejection. Can you find that information? 20 | 21 | The answer to this question is "no", because it's not there. It's [available in other contextual information that's accessible from Script Tasks](https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/1a25295cfee142dda232ed14a33c8665.html), and via the [Java Unified Expression Language](https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/9f91b1c0fac3414d9cba1015dea381f1.html) that can be used in various parts of workflow definitions, such as expressions for branching based on conditions. 22 | 23 | In the following steps we'll use a Script Task to access this information. 24 | 25 | 26 | ### 2. Add a Script Task to the workflow definition 27 | 28 | :point_right: Add a Script Task to the workflow definition via the "Tasks" menu in the graphical workflow editor in the SAP Web IDE Full-Stack, as shown. Place the task as the third and last task item in the flow, to be executed after the "Approval Decision" task: 29 | 30 | ![add Script Task](addscripttask.png) 31 | 32 | > Don't forget that you can use the arrangement buttons to tidy up the definition diagram like you did in [Exercise 09](../09#2-add-a-user-task-to-the-definition). 33 | 34 | The main purpose of this Script Task is to prepare a message that can eventually be sent to the requestor (the sending of the message will be left as an activity to be completed after this event finishes). So name this Script Task appropriately. 35 | 36 | :point_right: Set the "Name" property in the "Script Task Properties" to "Prepare Message". 37 | 38 | Script Tasks allow for the execution of logic written in JavaScript and contextual information about the instance in which the execution takes place, as well as metadata about the workflow instance itself, is available through special variables. The JavaScript is contained in files that are associated with the workflow definition. 39 | 40 | :point_right: Use the "Create File" link to create a new JavaScript file called `preparemessage.js` - notice where within the workflow project the file is stored. 41 | 42 | You're immediately taken into a file editor, with plenty of (commented out) examples of how to access and manipulate an instance's context: 43 | 44 | ```javascript 45 | /* 46 | // read from existing workflow context 47 | var productInfo = $.context.productInfo; 48 | var productName = productInfo.productName; 49 | var productDescription = productInfo.productDescription; 50 | 51 | // read contextual information 52 | var taskDefinitionId = $.info.taskDefinitionId; 53 | 54 | // read user task information 55 | var lastUserTask1 = $.usertasks.usertask1.last; 56 | var userTaskSubject = lastUserTask1.subject; 57 | var userTaskProcessor = lastUserTask1.processor; 58 | var userTaskCompletedAt = lastUserTask1.completedAt; 59 | 60 | var userTaskStatusMessage = " User task '" + userTaskSubject + "' has been completed by " + userTaskProcessor + " at " + userTaskCompletedAt; 61 | 62 | // create new node 'product' 63 | var product = { 64 | productDetails: productName + " " + productDescription, 65 | workflowStep: taskDefinitionId 66 | }; 67 | 68 | // write 'product' node to workflow context 69 | $.context.product = product; 70 | */ 71 | ``` 72 | 73 | :point_right: Take your time to [stare at](https://langram.org/2019/04/08/es6-reduce-and-pipe/) this code, taking in the three main access points for special information: 74 | 75 | - `$.context`: the context itself 76 | - `$.info`: data about the instance 77 | - `$.usertasks`: access to information in User Tasks 78 | 79 | :point_right: Below the commented out JavaScript (you may delete it all if you wish) add the following and save the file: 80 | 81 | ```javascript 82 | $.context.usertaskinfo = $.usertasks.usertask1.last; 83 | ``` 84 | 85 | > You may want to check the actual ID of the User Task that you added to the workflow definition; usually it's `usertask1` as the first one, but if you've been experimenting, it may be `usertask2` for example. Make sure the reference here reflects the ID of your specific User Task. 86 | 87 | :point_right: Save the workflow definition (you've saved the Script Task file but you've also made changes to the definition itself, remember) and then follow the usual "build/deploy" flow. 88 | 89 | :point_right: Once the deployment is complete, create a new instance using Postman as you've done before. 90 | 91 | 92 | ### 3. Process the User Task and check the context 93 | 94 | In this step you'll complete the instance you've just created by leaving a comment and making an approval or rejection decision, and then check that information in the workflow context. 95 | 96 | :point_right: In the "My Inbox" app, find the new User Task waiting for you, leave a comment, and make an approval or rejection decision. This should cause the task to disappear, and the workflow instance to run to completion. 97 | 98 | :point_right: Now use the "Workflow Monitor - Workflow Instances" app to find that instance that has just run to completion (again, make sure the "Completed" status is selected in the status filter) and examine the Workflow Context. It should look something like this: 99 | 100 | ![user task info in the workflow context](usertaskinfo.png) 101 | 102 | In the `usertaskinfo` property you can see that information about the User Task is clearly available, including the decision taken - in this example it was a rejection. 103 | 104 | ### 4. Prepare a message appropriate to send to the requester 105 | 106 | Armed with the decision information, you can now prepare a message, to be stored in the workflow context, to be eventually sent on to the requester. A Mail Task might be the best way to achieve this, but we won't cover it here. 107 | 108 | :point_right: Go back to the file editor for the `preparemessage.js` file. Below the line you already have, add the following: 109 | 110 | ```javascript 111 | $.context.message = 112 | "The request for " 113 | + $.context.productInfo.d.Name 114 | + " was " 115 | + ($.context.usertaskinfo.decision === "approve" ? "approved" : "rejected") 116 | + ". The stock quantity at the time was " 117 | + $.context.productInfo.d.StockQuantity 118 | + "."; 119 | ``` 120 | 121 | :point_right: Ensure the file is saved, and build & redeploy as usual. 122 | 123 | Now we're ready for one last instantiation of this workflow definition. 124 | 125 | :point_right: Create a new instance with Postman and complete the User Task that appears in the "My Inbox" app. Add a comment and approve or reject as you see fit. 126 | 127 | :point_right: Using the "Workflow Monitor - Workflow Instances", find the completed instance and examine the context - you should find a "message" property in there that is appropriate to your decision and to the stock of the product requested. Here's an example of one such message: 128 | 129 | **The request for Notebook Basic 19 was rejected. The stock quantity at the time was 150.** 130 | 131 | 132 | ## Summary 133 | 134 | In addition to Service Tasks and User Tasks, you're now familiar with Script Tasks and the information that's available to you during execution of such tasks. 135 | 136 | ## Questions 137 | 138 | 1. When looking at the comments in context, they were saved in a property with this path: `/response/comments`. Do you remember where this path came from, where it was specified? 139 | -------------------------------------------------------------------------------- /exercises/10/usertaskinfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/cloud-platform-workflow-virtual-event/42438633941779d0a75c603e2c658e88936669e6/exercises/10/usertaskinfo.png -------------------------------------------------------------------------------- /exercises/template.md: -------------------------------------------------------------------------------- 1 | # Exercise NN - Something ... 2 | 3 | In this exercise you'll ... 4 | 5 | ## Steps 6 | 7 | After completing these steps you'll ... 8 | 9 | ### 1. Do this ... 10 | 11 | ... 12 | 13 | ## Summary 14 | 15 | You've now ... 16 | 17 | ## Questions 18 | 19 | 1. ... 20 | 21 | -------------------------------------------------------------------------------- /prerequisites.md: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | 3 | There are hardware, software and service prerequisites for participating in this Virtual Event. 4 | 5 | ## Hardware 6 | 7 | Each participant must have their own laptop with enough admin privileges to be able to install software. You must also be able to access a command line shell (e.g. `cmd.exe` on Windows). The laptop must also be able to connect to the Internet. 8 | 9 | ## Software 10 | 11 | Before the Virtual Event, participants must ensure they have the following installed on their laptops: 12 | 13 | - Chrome (latest version) : [https://www.google.com/chrome/](https://www.google.com/chrome/) 14 | - Postman : [https://www.getpostman.com/downloads/](https://www.getpostman.com/downloads/) 15 | 16 | Participants should also install: 17 | 18 | - Docker Desktop : [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop) (once installed, test out the installation by following the instructions [here for macOS](https://docs.docker.com/docker-for-mac/) or [here for Windows](https://docs.docker.com/docker-for-windows/), ensuring that you can run the `docker` command line tool) 19 | 20 | _Note: Docker Desktop is required to host a container where you will run an instance of the SAP Cloud Connector in one of the exercises. The installation of Docker Desktop is strongly recommended, because not having it means that you will not be able to complete that exercise. However, you can still continue the Virtual Event as instructions will be provided describing the appropriate alternative configuration needed._ 21 | 22 | ## Services 23 | 24 | Each attendee must have the following already set up and enabled: 25 | 26 | - an SAP Cloud Platform trial account. If you need to create a new account, go to [https://account.hanatrial.ondemand.com/#/home/welcome](https://account.hanatrial.ondemand.com), select the "Register" button and follow the instructions. 27 | 28 | - within your SAP Cloud Platform trial account, the Cloud Foundry trial should be set up, with an organization and space ready to work in (if you follow the setup instructions on a new trial account, you'll be led through this process automatically). 29 | 30 | - an account on the SAP NetWeaver Gateway Demo system "ES5". [Sign up here](https://register.sapdevcenter.com/SUPSignForms/) and then ensure your account is active and the username and password are correct, by checking you can access HTTP-based services such as the [EPM_REF_APPS_SHOP_SRV](https://sapes5.sapdevcenter.com/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/?sap-client=002) OData service. If you need more help, you can follow the "[Create an Account on the Gateway Demo System](https://developers.sap.com/tutorials/gateway-demo-signup.html)" tutorial. 31 | 32 | 33 | ## Recommendations 34 | 35 | Further to the software prerequisites described above, we also recommend: 36 | 37 | - The [JSON Formatter extension](https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en) for Google Chrome 38 | - The [XML Tree extension](https://chrome.google.com/webstore/detail/xml-tree/gbammbheopgpmaagmckhpjbfgdfkpadb) for Google Chrome 39 | -------------------------------------------------------------------------------- /utils/delete-destination.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Delete one or more destinations 4 | 5 | destinations=$@ 6 | 7 | instance=$(uuidgen) 8 | key=$(uuidgen) 9 | 10 | echo Setup ... 11 | 12 | # Create destination service instance and service key 13 | cf create-service destination lite ${instance} 14 | cf csk ${instance} ${key} 15 | 16 | # Save the service key details and generate an access token 17 | cf service-key ${instance} ${key} | sed 1,2d > ./key.json 18 | token=$(gettoken) 19 | 20 | for destination in ${destinations}; do 21 | echo -n "Destinations with name '${destination}' deleted: " 22 | curl \ 23 | --silent \ 24 | --request DELETE \ 25 | --header "Authorization: Bearer ${token}" \ 26 | "$(skv uri)/destination-configuration/v1/subaccountDestinations/${destination}" \ 27 | | jq -r .Count 28 | done 29 | 30 | echo Teardown ... 31 | 32 | # Remove service key details, service key and service instance 33 | rm ./key.json 34 | dsik ${instance} 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /utils/reset.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Reset WFM environment in cf - use with care! 4 | # Deletes the services set up by the WFM booster, 5 | # and the apps and services deployed from the BPMServicesFLP.zip package. 6 | 7 | 8 | function deleteApp () { 9 | # Deletes the app, including any routes 10 | local target=${1} 11 | cf delete -f -r ${target} 12 | } 13 | 14 | 15 | # MAIN 16 | 17 | # First, show the user the cf and sapcp targets and get them to confirm 18 | cf target && sapcp 19 | read -p "Proceed with reset (y/n)? " yn 20 | [[ ! "$yn" =~ ^(y|Y)$ ]] && exit 0 21 | 22 | # Delete - apps 23 | deleteApp BPMFLP 24 | deleteApp BPMServicesFLP_appRouter 25 | 26 | # Delete - service instances 27 | read -r -d '' instances <